MegaBites-AI/Windows-powershell
0372
1// Copyright (c) Microsoft Corporation.2// Licensed under the MIT License.3 4using System;5using System.Diagnostics;6using System.Diagnostics.CodeAnalysis;7using System.Resources;8 9namespace Microsoft.PowerShell.Commands.GetCounter10{11 public class PerformanceCounterSample12 {13 internal PerformanceCounterSample()14 {15 }16 17 internal PerformanceCounterSample(string path,18 string instanceName,19 double cookedValue,20 UInt64 rawValue,21 UInt64 secondValue,22 uint multiCount,23 PerformanceCounterType counterType,24 UInt32 defaultScale,25 UInt64 timeBase,26 DateTime timeStamp,27 UInt64 timeStamp100nSec,28 UInt32 status)29 {30 Path = path;31 InstanceName = instanceName;32 CookedValue = cookedValue;33 RawValue = rawValue;34 SecondValue = secondValue;35 MultipleCount = multiCount;36 CounterType = counterType;37 DefaultScale = defaultScale;38 TimeBase = timeBase;39 Timestamp = timeStamp;40 Timestamp100NSec = timeStamp100nSec;41 Status = status;42 }43 44 public string Path { get; set; } = string.Empty;45 46 public string InstanceName { get; set; } = string.Empty;47 48 public double CookedValue { get; set; }49 50 public UInt64 RawValue { get; set; }51 52 public UInt64 SecondValue { get; set; }53 54 public uint MultipleCount { get; set; }55 56 public PerformanceCounterType CounterType { get; set; }57 58 public DateTime Timestamp { get; set; } = DateTime.MinValue;59 60 public UInt64 Timestamp100NSec { get; set; }61 62 public UInt32 Status { get; set; }63 64 public UInt32 DefaultScale { get; set; }65 66 public UInt64 TimeBase { get; set; }67 }68 69 public class PerformanceCounterSampleSet70 {71 internal PerformanceCounterSampleSet()72 {73 _resourceMgr = Microsoft.PowerShell.Commands.Diagnostics.Common.CommonUtilities.GetResourceManager();74 }75 76 internal PerformanceCounterSampleSet(DateTime timeStamp,77 PerformanceCounterSample[] counterSamples,78 bool firstSet) : this()79 {80 Timestamp = timeStamp;81 CounterSamples = counterSamples;82 }83 84 public DateTime Timestamp { get; set; } = DateTime.MinValue;85 86 [SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays",87 Scope = "member",88 Target = "Microsoft.PowerShell.Commands.GetCounter.PerformanceCounterSample.CounterSamples",89 Justification = "A string[] is required here because that is the type Powershell supports")]90 public PerformanceCounterSample[] CounterSamples { get; set; }91 92 private readonly ResourceManager _resourceMgr = null;93 }94}95 