C#: performance counters

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • PRR
    Recognized Expert Contributor
    • Dec 2007
    • 750

    C#: performance counters

    C#: programatically i wanna do
    In Admin tools: PErformance-> Performance Logs and Alerts
    i want to create "Counter Logs"
    New Log settings...
    Basically for printer (for testing if a printer prints more than 10 pages in one time, processor usage exceeds 50% )...
    i want logs to be created in Windows logs... Event viewer... I guess they do get created automatically.. ..

    now next thing is if i can do the above programatically ... how do i filters the logs ... so that i know which once i created?....

    is this code in right direction?

    if(!Performance CounterCategory .Exists("Grudge 2"))
    {
    CounterCreation DataCollection mycounter = new CounterCreation DataCollection( );

    CounterCreation Data test = new CounterCreation Data();
    test.CounterNam e = "Vanessa";
    test.CounterHel p="HALO";
    test.CounterTyp e = PerformanceCoun terType.NumberO fItems32;


    mycounter.Add(t est);

    PerformanceCoun terCategory.Cre ate("Grudge 2","Sample",myc ounter);

    }
  • PRR
    Recognized Expert Contributor
    • Dec 2007
    • 750

    #2
    Well i guess i actually wanna do this....
    C#: programatically i wanna do
    In Admin tools: PErformance-> Performance Logs and Alerts
    /// CHANGE HERE
    i want to create "Alerts"

    New Log settings...
    Basically for printer (for testing if a printer prints more than 10 pages in one time, processor usage exceeds 50% )...
    i want logs to be created in Windows logs... Event viewer... I guess they do get created automatically.. ..

    now next thing is if i can do the above programatically ... how do i filters the logs ... so that i know which once i created?....

    Comment

    Working...