2

I've been using Wakoopa recently, and I find it quite amusing.

I had no idea ( well I had an idea but never got real data about it ) on how much time I spend in SO until this:

alt text http://img396.imageshack.us/img396/4699/wakoopaim1.png

So my programming question is:

How can I programmatically track the applications being used?

My initial though was to use something like "tasklist" command and "netstat" and pool every 15 minutes or something like that, but I don't think this is the way they're doing this.

Is there a library in .NET ( in C# I guess ) to do this? Does windows provides some kind of service like this? What about java?

I usually have at least some vague idea on how some programming task could be performed, but for this I don't have a clue.

The wakoopa app tracker works on OSX and Linux too, but it is clear to me they are three different apps, one per platform

BTW, how much do you used SO? :)

OscarRyz
  • 196,001
  • 113
  • 385
  • 569
  • 1
    How do they define "using" SO? Do they mean I have one of my browser tabs showing it, or it's the currently visible browser tab, or that browser tab actually has input focus, or that I'm actually typing in that tab? Because you'd get very different answers for each of those options. – Paul Tomblin Jan 06 '09 at 19:02
  • Yes that is very interesting. As far as I can tell, they measure the time a tab is open, not necessarily working on it. Do you have any idea? – OscarRyz Jan 06 '09 at 19:14
  • If I used Windows I might give it a try, but only on a computer I could wipe and re-install when I was done. Then I could see if SO was given 24 hours a day (tab open), 12 hours a day (tab is visible), or 6 hours (tab has focus)... – Paul Tomblin Jan 06 '09 at 19:25
  • It will be ready for Linux any time soon. How would you do this in linux/unix? ps -feax? ... Or something like that? – OscarRyz Jan 06 '09 at 19:29
  • Check the source for top at the PROCPS site I linked below. – Philip Tinney Jan 06 '09 at 19:41

2 Answers2

1

Here is a link to an article with source covering the Process Structure Routines API Detecting Windows NT/2K process execution. I thought that the SysInternals site had source to Process Monitor, but I don't see any. The article should point you in the right direction for Windows systems.

Here is a link that may be helpful for Linux systems PROCPS

Here is a link to a java swing top utility Monitor It uses JNI, so not sure if it really fits as a java solution.

And to answer the SO question, I only periodically visit the site. I find I spend too much time on it if I visit regularly.

Philip Tinney
  • 1,986
  • 17
  • 19
1

Familiarize yourself with the Server Explorer in Visual Studio -- look under 'Process'. Then read up on the PerformanceCounter class.

Mark Maxham
  • 1,501
  • 2
  • 13
  • 19