Granville Barnett

March 2008 - Posts

CPU Scheduling Simulator 0.8 Beta 2 Released!

Download CPUSS 0.8 Beta 2

Beta 2 is not really very revolutionary, however it does add some tooling support to CPUSS:

  • CPUSS Report Generator (cpussrg.exe)
CPUSSRG

This is a little tool that allows you to invoke a strategy against some specified processes, and then view a HTML report of the simulation. The report exposes a very small amount of data recorded by CPUSS and in RC I may add more, but at the moment for a high level view it is ok.

CPUSSRG uses a plugin model. If you want to use CPUSSRG then it is relatively simple, all you need to do is put your algorithms in an assembly (.dll) and make sure you implement IStrategy. Place your algorithm assembly into the Plugin folder of the CPUSSRG tool and you are good to go.

I will post later on how to use it more extensively.

Download CPUSS 0.8 Beta 2

CPUSS Beta 1 released!

Download CPUSS

A few new things in this release:

  • Command line report generator
  • Variance and standard deviation methods that take predicate functions as args
  • Repeat runner
  • Html report generator
  • Graphing support

Download CPUSS

Note: since I added a reference to NPlot in SHFB the XMLDoc's are reported as missing, I am working to resolve this.

Free graphing libraries for .NET - my thoughts

I've not really looked around until today, but I really wanted to include graphing as part of some tooling for CPUSS and I found two libraries:

Each of which from what I have read on the web has a pretty decent reputation, although NPlot tended to be associated with a lack of documentation/examples but I figured this wouldn't be a problem as I am pretty clued up on graphing, and I hoped that the library respected certain naming conventions and so on from the theory side...it did thankfully!

I had heard of NPlot before, if only in passing - ZedGraph I had never heard of though before and surprisingly out of the two it seemed to be the more established in terms of release drops.

So I had two libraries that could create various graphs, then I decided to take each for a spin...

NPlot

Surprisingly after all I had read about NPlot I actually found it very easy to figure out, I didn't use the WinForms designer (as you can tell from the project) I did everything from scratch as I needed a more atomic control on things and the designer hides a lot of that stuff.

I very quickly created a nice graph with 3 line plots on.

Plot of Simulation

Very simple, I have noted a few observations in the project files that you can read if you are interested relating around surface axis labels and the x-axis data values.

ZedGraph

I found ZedGraph to be a little overkill for what I needed although it did offer a lot of more visual candy than NPlot seemed to.

WindowClipping

Needless to say I played around with ZedGraph for a while and saw that while it was very easy to use, NPlot seemed to provide more elegant off the bat graphs with minimal input from me.

Summary

Even though I only played with each for a very brief time I found NPlot to be a bit quicker to setup than ZedGraph, the latter of which seems to hold a lot more usability hooks - things like graceful zooming, associating symbols with graphs etc.

If you know of any other libraries that are free and worth checking out please let me know!

Posted: Mar 23 2008, 09:49 PM by gbarnett | with 6 comment(s) |
Filed under: , , ,
Variance and standard deviation of process wait times with CPUSS

Getting the variance and standard deviation of process wait times over the course of the simulation is really simple, it's simply a call to a few methods.

Note: in CPUSS 0.7 there will be overloads for GetVariance and GetStandardDeviation that accept a predicate function so you can get the stats on specific processes.

    1 using System;

    2 using Cpuss;

    3 using Cpuss.Strategies;

    4 

    5 namespace ConsoleApplication1

    6 {

    7     class Program

    8     {

    9         static void Main()

   10         {

   11             Runner runner = new Runner(15, 12, 34, new ShortestJobFirstExpert(5, 25));

   12             runner.Run();

   13             Console.WriteLine("{0}ns", runner.GetVariance());

   14             Console.WriteLine("{0}ns", runner.GetStandardDeviation());

   15             // ...

   16         }

   17     }

   18 }

 

CPU Scheduling Simulator 0.6 released!

Download CPUSS 0.6

Some cool new features added in this release, they include:

  • Variance
  • Standard Deviation
  • CPU Busy Time
  • CPU Idle Time
  • Get average wait time for a category of process (this uses a predicate function)

I am tempted to say that this build is pretty much feature complete, any further additions will be minor.

Future releases will be focused on bug fixes, and a command line tool for invoking load generated process tests etc.

Download CPUSS 0.6

Getting average wait times for processes with certain properties via predicate functions

This is the first time really that passing in a predicate function has made sense. I use the Func<T0, ...> type that takes a Process parameter and returns a bool, below is an example of using the overridden version of GetAverageWaitTime with a predicate function – here only processes with a burst time greater than the lower large burst time bound will satisfy the predicate.

runner.GetAverageWaitTime(x => x.BurstTime > (int)BurstTime.LargeMin)

You can download the bits here (change set #9443 and later).

Using CPU Scheduling Simulator with F#

Just a quickie and a dead simple example, CPUSS is really easy to use with any managed language including C++/CLI, VB.NET and F# but I chose F# to create a real easy program to show the synergy between the two as you might expect is very good.

    1 #light

    2 

    3 #r @"<release dir>\Cpuss.dll"

    4 #r @"<release dir>\Cpuss.Strategies.dll"

    5 

    6 open System

    7 open Cpuss

    8 open Cpuss.Strategies

    9 

   10 let setup =

   11   let r = new Runner(10, 10, 25, new RoundRobin(5))

   12   r.Run()

   13   (r.BusyCpuTime, r.IdleCpuTime, r.GetAverageWaitTime())

   14 

   15 let stats =

   16   let busy, idle, avg = setup

   17   printfn "Busy CPU Time: %dns" busy

   18   printfn "Idle CPU Time: %dns" idle

   19   printfn "Average Wait Time: %gns" avg

Enjoy!

CPU Scheduling Simulator 0.5 released!

Download CPUSS 0.5

I got bored today (I really should be preparing for stuff I have coming up in the next few days!!) looking at random stuff in preparation for the next few days, so I broke off for a while and decided to finish up CPUSS 0.5 release which contains:

  • Process resumed event
  • Min/Max wait time achieved by any process during the simulation
  • WaitTime now computed for every process rather than the total average (which is still there)

Download CPUSS 0.5

CPU Scheduling Simulator 0.4 Released!

Download CPUSS 0.4

A fairly minor release with a little work cleaning the API up a little by reducing ambiguity (definition of ProcessLoad, and Pairs collections).

Also added an event that allows you to subscribe to process preemption, as well as scattered priorities for auto generated process loads.

I added the option to specify a poll time for the priority first and shortest job first strategies, I did debate about just using a standard poll time but I think the flexibility is probably best in this case.

Download CPUSS 0.4

Future iterations

Below are the features that will be added in both CPUSS 0.5 and 0.6 respectively.

CPUSS 0.5

  • Process resumed event
  • Wait times for each process
  • Min wait time
  • Max wait time

CPUSS 0.6

  • CPU idle time
  • CPU busy time
  • Standard deviation
  • Average wait time based on a predicate function
New stats feature on CodePlex

Just noticed this tab a few minutes ago. Sweet.

CPU Scheduling Simulator - Windows Internet Explorer

This is a great new feature!

Check it out here.

Posted: Mar 13 2008, 04:07 PM by gbarnett
Filed under: ,
More Posts Next page »