Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


advertisement
 

Monitor Your Applications With Vista's Performance Logs and Alerts : Page 3

Instrument real-time and logged performance monitoring in your applications with the new Performance Logs and Alerts API.


advertisement
Creating a Data Collector Set with the PLA API
Creating a data collector set programmatically takes only a few lines of code when you have an appropriately configured XML template already available. You can use the template you just created as a base; modify the path variable in the code below to suit your needs:

using PlaLibrary; ... // Load the XML template string path = @"C:\Development\DevX.Pla\DevX.Pla.Template.xml"; StreamReader reader = File.OpenText(path); string templateXml = reader.ReadToEnd(); reader.Close(); // Create the data collector set IDataCollectorSet collectorSet = new DataCollectorSetClass(); collectorSet.SetXml(templateXml); // Save the data collector set for later use string name = @"Service\DevX (Created with the PLA API)"; collectorSet.Commit(name, null, CommitMode.plaCreateOrModify);

Use the IDataCollectorSet.SetXml method as shown in the preceding code to configure the data collector set with an XML template. You can also configure the data collector set manually through exposed IDataCollectorSet properties, such as IDataCollectorSet.OutputLocation and IDataCollectorSet.RootPath.

 
Figure 8: Commit Method: Use the IDataCollectorSet.Commit method to save a collector set for later use.
The IDataCollectorSet.Commit method saves the data collector set. Here's the syntax for a Commit call:

IDataCollectorSet.Commit(string name, string server, CommitMode mode);

Data collector sets you save with the Commit method will appear next to other user defined data collector sets in the RPM (see Figure 8).

The Commit method provides powerful mechanisms for deploying and reusing data collector sets through its three parameters, described in Table 1.

Table 1.IDataCollectorSet.Commit Parameters: The parameters for the Commit method provide powerful mechanisms for deploying and reusing data collector sets.
Parameter Allowed Values Description
name Service\<name> Sets created by the user; can be scheduled and set to run as anyone.
System\<name> Read-only sets; cannot be scheduled.
Legacy\<name> Sets running on operating systems prior to Vista.
Session\<name> Special-purpose namespace for Event Tracing sessions.
Autosession\<name> Special-purpose namespace for Event Tracing AutoLogger sessions.
server Computer name, fully qualified domain name, IP address (IPv4 or IPv6), or null for the local computer. Computer on which to save the data collector set.
mode plaCreateNew Creates a new set; fails if it already exists.
plaModify Modifies an existing set; fails if it doesn't already exist.
plaCreateOrModify Creates a new set or updates it if it already exists.
plaUpdateRunningInstance Applies new properties to the running set instance.
plaFlushTrace Applies only to sets with Event Tracing sessions.
plaValidateOnly Validates the set's properties.



Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap