PC Review


Reply
Thread Tools Rate Thread

Diagnostic "pins" with .NET?

 
 
Chris Johnson
Guest
Posts: n/a
 
      7th Mar 2008
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



 
Reply With Quote
 
 
 
 
Jon Skeet [C# MVP]
Guest
Posts: n/a
 
      7th Mar 2008
Chris Johnson <(E-Mail Removed)> wrote:
> 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 - <(E-Mail Removed)>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk
 
Reply With Quote
 
Cowboy \(Gregory A. Beamer\)
Guest
Posts: n/a
 
      7th Mar 2008
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" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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
>
>
>



 
Reply With Quote
 
John Vottero
Guest
Posts: n/a
 
      10th Mar 2008
"Chris Johnson" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
"Diagnostic Policy Service" crashes on Vista Basic Paul_Lucy Windows Vista Installation 2 7th Apr 2009 12:55 AM
Sort no longer "pins" the message you're sorting by Audrey Bennett Microsoft Outlook Discussion 0 13th Feb 2009 12:41 AM
Automatically starts with "diagnostic boot selected" ..... =?Utf-8?B?YmlnYmxpbXBpbg==?= Windows XP Help 3 1st Aug 2005 12:58 AM
Diagnostic of default "adapters of mini-port" =?Utf-8?B?TmVsc29u?= Windows XP New Users 0 13th Sep 2004 12:23 AM
media player says "pins are not connected" Windows XP Video 0 7th Aug 2004 01:28 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:02 AM.