Created
October 2, 2014 08:25
-
-
Save kerslake/2470ac76678747f77786 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void Main() | |
{ | |
IObservable<PerformanceSample> performanceCounterObservable = PerfCounterObservable.FromRealTime(TimeSpan.FromSeconds(1), new[]{ | |
@"\Processor(_Total)\% Processor Time", | |
@"\Memory(_Total)\% Committed Bytes In Use", | |
@"\Memory(_Total)\Available MBytes"}) | |
.Take(6); | |
performanceCounterObservable.Subscribe(new PerfSampleObserver()); | |
} | |
class PerfSampleObserver : IObserver<PerformanceSample> | |
{ | |
public void OnNext(PerformanceSample sample) | |
{ | |
sample.Dump(); | |
} | |
public void OnError(Exception error) | |
{ | |
} | |
public void OnCompleted() | |
{ | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment