本文整理汇总了C#中PerformanceCounterType类的典型用法代码示例。如果您正苦于以下问题:C# PerformanceCounterType类的具体用法?C# PerformanceCounterType怎么用?C# PerformanceCounterType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PerformanceCounterType类属于命名空间,在下文中一共展示了PerformanceCounterType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateCounter
public static PerformanceCounter CreateCounter(string name, string description, PerformanceCounterType type)
{
if (_countersAllowed == false)
{
return null;
}
string categoryName = Application.ProductName + "." + name;
if (PerformanceCounterCategory.Exists(categoryName) == false)
{
CounterCreationDataCollection counters = new CounterCreationDataCollection();
CounterCreationData counterData = new CounterCreationData();
counterData.CounterName = name;
counterData.CounterHelp = description;
counterData.CounterType = type;
counters.Add(counterData);
PerformanceCounterCategory category = PerformanceCounterCategory.Create(categoryName, "Category for the counters of " + Application.ProductName,
PerformanceCounterCategoryType.SingleInstance, counters);
}
PerformanceCounter counter = new PerformanceCounter(categoryName, name, string.Empty, false);
return counter;
}
示例2: PerformanceCounterSample
internal PerformanceCounterSample(string path,
string instanceName,
double cookedValue,
UInt64 rawValue,
UInt64 secondValue,
uint multiCount,
PerformanceCounterType counterType,
UInt32 defaultScale,
UInt64 timeBase,
DateTime timeStamp,
UInt64 timeStamp100nSec,
UInt32 status)
{
_path = path;
_instanceName = instanceName;
_cookedValue = cookedValue;
_rawValue = rawValue;
_secondValue = secondValue;
_multiCount = multiCount;
_counterType = counterType;
_defaultScale = defaultScale;
_timeBase = timeBase;
_timeStamp = timeStamp;
_timeStamp100nSec = timeStamp100nSec;
_status = status;
}
示例3: PerformanceCounterDefinition
internal PerformanceCounterDefinition(string categoryName, string counterName, string counterHelp, PerformanceCounterType counterType)
{
_categoryName = categoryName;
_counterName = counterName;
_counterHelp = counterHelp;
_counterType = counterType;
}
示例4: CreateCounter
public IICPerformanceCounter CreateCounter(string counterName, PerformanceCounterType counterType)
{
IICPerformanceCounter counter = new IICPerformanceCounter();
counter._rawAttr = new IICPerformanceCounterAttribute(counterName, counterType);
_counters.Add(counter);
return counter;
}
示例5: CounterCreationData
public CounterCreationData(String counterName, String counterHelp,
PerformanceCounterType counterType)
{
this.counterName = counterName;
this.counterHelp = counterHelp;
this.counterType = counterType;
}
示例6: CounterCreationDataInfo
public CounterCreationDataInfo(string counterName, string instanceName, PerformanceCounterType counterType, string counterHelp)
{
this.counterName = counterName;
this.instanceName = instanceName;
this.counterHelp = counterHelp;
this.counterType = counterType;
}
示例7: RunPerformanceAsync
public async Task RunPerformanceAsync(string name, PerformanceCounterType performanceCounterType, TimeframeType timeframeType, IProgress<Tuple<PerformanceCounterType, PerfCounterModel>> progress)
{
await Task.Run(async () =>
{
var random = new Random();
int prevPoint = 0;
while (true)
{
await Task.Yield();
int point = prevPoint > 0 ? prevPoint : startPoint;
// Update the point price by a random factor of the range percent
int number = (point + (int)(random.NextDouble() * random.Next(0, 30))) - random.Next(0, 50);
if (number < minPoint)
{
number = random.Next(0, 10);
}
else if (number > maxPoint)
{
number = 100;
}
progress.Report(new Tuple<PerformanceCounterType, PerfCounterModel>(performanceCounterType, new PerfCounterModel { Timestamp = DateTime.Now, Value = number }));
await Task.Delay(250);
prevPoint = number;
}
}).ConfigureAwait(false);
}
示例8: PerfCounterCreationData
public PerfCounterCreationData(PerformanceCounterName name, PerformanceCounterType type, string displayName, string helpText)
{
counterName = name;
counterType = type;
counterDisplayName = displayName;
counterHelpText = helpText;
}
示例9: CounterDescriptor
public CounterDescriptor(string name, string help, PerformanceCounterType type)
: this()
{
Name = name;
Help = help;
Type = type;
}
示例10: PerformanceCounterData
internal PerformanceCounterData(string name, string description, PerformanceCounterType counterType, PerformanceCounterActionMapping[] mappings)
{
this.Name = name;
this.Description = description;
this.CounterType = counterType;
this.Mappings = mappings;
}
示例11: CounterAttribute
/// <summary>
/// Constructor
/// </summary>
/// <param name="name">Name of the counter</param>
/// <param name="info">Information about the counter</param>
/// <param name="counterType">Type of counter</param>
/// <param name="baseAutoIncreased">if true, each time the performance counter increased/decreased its base will be increased/decrease on 1 point. Otherwise all that base management will need to be handed on client code</param>
/// <seealso cref="PerformanceCounterType"/>
public CounterAttribute(string name, string info, PerformanceCounterType counterType, bool baseAutoIncreased)
: base()
{
this.name = name;
this.info = info;
this.counterType = counterType;
this.baseAutoIncreased = baseAutoIncreased;
}
示例12: CounterCreationData
public CounterCreationData (string counterName,
string counterHelp,
PerformanceCounterType counterType)
{
CounterName = counterName;
CounterHelp = counterHelp;
CounterType = counterType;
}
示例13: AddDefinition
protected PerformanceCounterDefinition AddDefinition(string counterName, string counterHelp, PerformanceCounterType counterType)
{
var definition = new PerformanceCounterDefinition(_categoryName, counterName, counterHelp, counterType);
_counterDefinitions.Add(definition.GetCreationData());
return definition;
}
示例14: AddCounter
public FluentCategoryConfigurator AddCounter(
string name,
string help = "",
PerformanceCounterType type = PerformanceCounterType.NumberOfItems32)
{
_counters.Add(new CounterCreationData(name, help, type));
return this;
}
示例15: STPPerformanceCounter
// Methods
public STPPerformanceCounter(
string counterName,
string counterHelp,
PerformanceCounterType pcType)
{
this._counterName = counterName;
this._counterHelp = counterHelp;
this._pcType = pcType;
}