• [转]Creating a Data Collector Set with the PLA API


    http://www.devx.com/dotnet/Article/35157/0/page/3

    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 Commitcall:

       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 Commitmethod 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.
  • 相关阅读:
    Python 函数内变量的作用域
    python return 及lambda函数
    python 函数的定义及传参
    Python 集合
    python 内置函数
    Python 字典
    Python 元组
    LoaRunner性能测试系统学习教程:Windows计数器(2)
    LoaRunner性能测试系统学习教程:操作系统监控(1)
    LoaRunner性能测试系统学习教程:结果分析实践之Summary View(8)
  • 原文地址:https://www.cnblogs.com/swanestle/p/2664042.html
Copyright © 2020-2023  润新知