Click or drag to resize

ProcessDataPerfInfoPushProvider Class

Processor Performance Data Information Provider - Push.
Inheritance Hierarchy
SystemObject
  Xcalibur.WMI.FrameworkWmiModelBaseIProcessPerfDataInfo, ProcessPerfDataInfo
    Xcalibur.WMI.FrameworkWmiPushModelBaseIProcessPerfDataInfo, ProcessPerfDataInfo
      Xcalibur.WMI.ProcessesProcessDataPerfInfoPushProvider

Namespace:  Xcalibur.WMI.Processes
Assembly:  Xcalibur.WMI (in Xcalibur.WMI.dll) Version: 3.0.0.0 (3.0.1.0)
Syntax
public sealed class ProcessDataPerfInfoPushProvider : WmiPushModelBase<IProcessPerfDataInfo, ProcessPerfDataInfo>, 
	IProcessDataPerfInfoPushProvider, IWmiPushModelBase<IProcessPerfDataInfo>, IWmiModelBase<IProcessPerfDataInfo>, 
	IDisposable

The ProcessDataPerfInfoPushProvider type exposes the following members.

Constructors
  NameDescription
Public methodCode exampleProcessDataPerfInfoPushProvider
Initializes a new instance of the ProcessDataPerfInfoPushProvider class.
Top
Properties
Methods
  NameDescription
Public methodCreateWatcher
Creates the event watcher.
(Inherited from WmiPushModelBaseTData, TDataModel.)
Public methodDispose
Implement IDisposable. Do not make this method virtual. A derived class should not be able to override this method.
(Inherited from WmiModelBaseTData, TDataModel.)
Public methodDispose(Boolean)
Dispose(bool disposing) executes in two distinct scenarios. If disposing equals true, the method has been called directly or indirectly by a user's code. Managed and unmanaged resources can be disposed. If disposing equals false, the method has been called by the runtime from inside the finalizer and you should not reference other objects. Only unmanaged resources can be disposed.
(Inherited from WmiPushModelBaseTData, TDataModel.)
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Public methodGet
Gets the specified object.
(Inherited from WmiModelBaseTData, TDataModel.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodStart
Starts this instance.
(Inherited from WmiPushModelBaseTData, TDataModel.)
Public methodStop
Stops this instance.
(Inherited from WmiPushModelBaseTData, TDataModel.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodUpdate(Int32)
Updates this instance.
(Inherited from WmiPushModelBaseTData, TDataModel.)
Public methodUpdateTConfig(TConfig, Int32)
Updates the specified configuration.
(Inherited from WmiModelBaseTData, TDataModel.)
Top
Events
Examples
C#
  1// Main
  2private static void Main()
  3{
  4    // Make a connection to the local machine
  5    const string computer = ".";
  6    var managementScope = new ManagementScope($@"\\{computer}\root\cimv2", new ConnectionOptions
  7    {
  8        Impersonation = ImpersonationLevel.Impersonate,
  9        Authentication = AuthenticationLevel.Connect
 10    });
 11    managementScope.Connect();
 12
 13    // Process performance data configuration
 14    // We need to specify what we want to retrieve
 15    var config = new ProcessPerfDataConfig
 16    {
 17        IDProcess = true,
 18        Name = true,
 19        WorkingSet = true,
 20        WorkingSetPrivate = true,
 21        Timestamp_Sys100NS = true
 22    };
 23
 24    // Process performance data information on a 1-second polling cycle for Process ID: 19248
 25    var provider = new ProcessDataPerfInfoPushProvider(managementScope, config, 1000, 19248);
 26
 27    // Items Added
 28    provider.ItemsAdded += (item, e) =>
 29    {
 30        Console.WriteLine("Event: Item Added");
 31        Console.WriteLine($"{item.IDProcess}: \t{item.Name}");
 32        Console.WriteLine("");
 33    };
 34
 35    // Items Modified
 36    provider.ItemsModified += (item, e) =>
 37    {
 38        Console.WriteLine("Event: Item Modified");
 39        Console.WriteLine($"{item.IDProcess}: \t{item.Name}");
 40
 41        // We chose these values because we know they will constantly increase
 42        Console.WriteLine($"Working Set: \t\t{item.WorkingSet}");
 43        Console.WriteLine($"Private Working Set: \t{item.WorkingSetPrivate}");
 44        Console.WriteLine($"Timestamp: \t\t{item.TimestampSys100Ns}");
 45        Console.WriteLine("");
 46    };
 47
 48    // Items Deleted
 49    provider.ItemsDeleted += (item, e) =>
 50    {
 51        Console.WriteLine("Event: Item Deleted");
 52        Console.WriteLine($"{item.IDProcess}: \t{item.Name}");
 53        Console.WriteLine("");
 54    };
 55
 56    // Read
 57    Console.Read();
 58}
 59
 60/* Results: 
 61 * 
 62 *  Event: Item Added
 63 *  19248:  WindowsDashboard
 64 *  
 65 *  Event: Item Modified
 66 *  19248:  WindowsDashboard
 67 *  Working Set:            114995200
 68 *  Private Working Set:    49004544
 69 *  Timestamp:              131654592956557516
 70 *  
 71 *  Event: Item Modified
 72 *  19248:  WindowsDashboard
 73 *  Working Set:            115326976
 74 *  Private Working Set:    49336320
 75 *  Timestamp:              131654592978271674
 76 *  
 77 *  Event: Item Modified
 78 *  19248:  WindowsDashboard
 79 *  Working Set:            115331072
 80 *  Private Working Set:    49340416
 81 *  Timestamp:              131654593000080330
 82 *  
 83 *  Event: Item Modified
 84 *  19248:  WindowsDashboard
 85 *  Working Set:            115331072
 86 *  Private Working Set:    49373184
 87 *  Timestamp:              131654593022029765
 88 *  
 89 *  Event: Item Modified
 90 *  19248:  WindowsDashboard
 91 *  Working Set:            115331072
 92 *  Private Working Set:    49373184
 93 *  Timestamp:              131654593044073874
 94 *  
 95 *  Event: Item Modified
 96 *  19248:  WindowsDashboard
 97 *  Working Set:            114966528
 98 *  Private Working Set:    49008640
 99 *  Timestamp:              131654593065870185
100 *  
101 *  Event: Item Modified
102 *  19248:  WindowsDashboard
103 *  Working Set:            114974720
104 *  Private Working Set:    49016832
105 *  Timestamp:              131654593087916491
106 *  
107 *  Event: Item Modified
108 *  19248:  WindowsDashboard
109 *  Working Set:            115290112
110 *  Private Working Set:    49332224
111 *  Timestamp:              131654593109661946
112 * 
113 */
See Also