Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > .NET General

Vista - Diagnostic "pins" with .NET?

Reply
 
Old 03-07-2008   #1 (permalink)
Chris Johnson


 
 

Diagnostic "pins" with .NET?

Hi all,

Just a quick question as I'm not entirely certain what phrase to google for
as all attempts so far have failed to illicit anything useful, and the best
anaology I can think of comes from hardware :-)

I'm curious as to whether there's some form of API in .NET that's the
software equivalent of diagnostic pins on a circuit board? Essentially I'm
want to have a bucket I can throw diagnostic message into in a
fire-and-forget method, and not care whether there's something looking at
the bucket (connected to the pin) or not. If nothing's listening, the
message gets forgotten about.

Ideally it needs to be lightweight with little latency -- the intention is
to use the 'pin' as a performance diagnostic, so in normal situations,
nothing would be connected. If there are problems, then we can attach to the
pin and read timestamp messages. An event queue would be no good: queue
would eventually fill-up and hang the code, unless there was extra logic in
the code to clean the queue up, which could start getting messy. Performance
counters won't really work either as that then requires a large chunk of
logic to keep track of individual entities in order to create an "average
latency" counter.

Essentially it's analogous to attaching an oscilloscope to a circuit board
and looking at the latency of stuff between two pins on a chip, etc.

I suppose shared memory might be one possible solution, but I understand
there's no CLR wrappers for shared memory (excluding third party
extensions). If anyone's got ideas or pointers, I'd be grateful to hear
them.

Cheers,

Chris




My System SpecsSystem Spec
Old 03-07-2008   #2 (permalink)
Jon Skeet [C# MVP]


 
 

Re: Diagnostic "pins" with .NET?

Chris Johnson <cej@xxxxxx> wrote:
Quote:

> Just a quick question as I'm not entirely certain what phrase to google for
> as all attempts so far have failed to illicit anything useful, and the best
> anaology I can think of comes from hardware :-)
>
> I'm curious as to whether there's some form of API in .NET that's the
> software equivalent of diagnostic pins on a circuit board? Essentially I'm
> want to have a bucket I can throw diagnostic message into in a
> fire-and-forget method, and not care whether there's something looking at
> the bucket (connected to the pin) or not. If nothing's listening, the
> message gets forgotten about.
Sounds like you want a logging framework.

Personally I like log4net:
http://logging.apache.org/log4net/

It'll be up to you what kind of log sinks you want to use (and you
don't need to make that decision when writing the code which calls into
log4net, of course).

--
Jon Skeet - <skeet@xxxxxx>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk
My System SpecsSystem Spec
Old 03-07-2008   #3 (permalink)
Cowboy \(Gregory A. Beamer\)


 
 

Re: Diagnostic "pins" with .NET?

You can do this with delegates. you have to code safe, to avoid errors when
there are no subscribers (unless you add a "default" subscriber like a log).
To have it so outside software can hook in, you will need to build a
lightweight publisher/subscriber type of model. I do not have links right
now for these, but a google on delegates (or better yet, multicast
delegates) and publisher/subscriber (not sure how to frame that one) should
yield some patterns and sample code, if nothing else.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

*************************************************
| Think outside the box!
|
*************************************************
"Chris Johnson" <cej@xxxxxx> wrote in message
news:%23zZDyxGgIHA.4744@xxxxxx
Quote:

> Hi all,
>
> Just a quick question as I'm not entirely certain what phrase to google
> for as all attempts so far have failed to illicit anything useful, and the
> best anaology I can think of comes from hardware :-)
>
> I'm curious as to whether there's some form of API in .NET that's the
> software equivalent of diagnostic pins on a circuit board? Essentially I'm
> want to have a bucket I can throw diagnostic message into in a
> fire-and-forget method, and not care whether there's something looking at
> the bucket (connected to the pin) or not. If nothing's listening, the
> message gets forgotten about.
>
> Ideally it needs to be lightweight with little latency -- the intention is
> to use the 'pin' as a performance diagnostic, so in normal situations,
> nothing would be connected. If there are problems, then we can attach to
> the pin and read timestamp messages. An event queue would be no good:
> queue would eventually fill-up and hang the code, unless there was extra
> logic in the code to clean the queue up, which could start getting messy.
> Performance counters won't really work either as that then requires a
> large chunk of logic to keep track of individual entities in order to
> create an "average latency" counter.
>
> Essentially it's analogous to attaching an oscilloscope to a circuit board
> and looking at the latency of stuff between two pins on a chip, etc.
>
> I suppose shared memory might be one possible solution, but I understand
> there's no CLR wrappers for shared memory (excluding third party
> extensions). If anyone's got ideas or pointers, I'd be grateful to hear
> them.
>
> Cheers,
>
> Chris
>
>
>

My System SpecsSystem Spec
Old 03-10-2008   #4 (permalink)
John Vottero


 
 

Re: Diagnostic "pins" with .NET?

"Chris Johnson" <cej@xxxxxx> wrote in message
news:%23zZDyxGgIHA.4744@xxxxxx
Quote:

> Hi all,
>
> Just a quick question as I'm not entirely certain what phrase to google
> for as all attempts so far have failed to illicit anything useful, and the
> best anaology I can think of comes from hardware :-)
>
> I'm curious as to whether there's some form of API in .NET that's the
> software equivalent of diagnostic pins on a circuit board? Essentially I'm
> want to have a bucket I can throw diagnostic message into in a
> fire-and-forget method, and not care whether there's something looking at
> the bucket (connected to the pin) or not. If nothing's listening, the
> message gets forgotten about.
>
Look at System.Diagnostics.TraceSource.

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Vista only boots up to "Startup Error" Diagnostic Tool after SP1 Windows Updates
"msdt" (microsoft Diagnostic Tool) General Discussion
Vista not wotking with "My Computer" or "Control Panel", "Screen Saver" Vista General
"Diagnostic Policy Service" crashes on Vista Basic Vista installation & setup
Tcp/IP diagnostic tool - "Process Explorer" Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46