views:

24

answers:

2

Are there any built-in mechanisms in .Net that would allow us to write two programs, A and B. A is a process with special hooks onto which B attaches itself. This would allow B to gather whatever information those hooks provided.

In particular, it would be nice to be able to dial into another of our process and gather suchs metrics like how many times a function was called in the last X minutes, the average run length, how many items are in this or that cache, etc.

A: 

It depends what you want to do. A lot of the metrics you describe can be captured with a profiler from within your debugger (so you wouldn't need to write program B at all, or change program A in any way).

Or you could implement a messaging interface (e.g. using sockets) that allows program B to request information from program A. Program A could supply a background thread to provide this information so that it can answer whenever a request is made regardless of what other work it might be engaged in.

Jason Williams
+2  A: 

You could write an application with the .NET Profiling API. Or, you could use logging, controlled by runtime options, config files, or registry settings for how verbose your logs will be. Or you could pay a lot of money for existing commercial profiling solutions.

You could also use MSMQ instead of logging.

maxwellb