Ejemplo n.º 1
0
        public long GetFilesSummary(out CounterFileInfo summary)
        {
            IntPtr        pdwNumEntries = new IntPtr(0);
            PDH_TIME_INFO structure     = new PDH_TIME_INFO();
            IntPtr        pdwBufferSize = new IntPtr(Marshal.SizeOf(structure));
            long          num           = PdhGetDataSourceTimeRangeH(this.m_hDataSource, ref pdwNumEntries, ref structure, ref pdwBufferSize);

            if (num != 0)
            {
                summary = new CounterFileInfo();
                return(num);
            }
            summary = new CounterFileInfo(new DateTime(DateTime.FromFileTimeUtc(structure.StartTime).Ticks, DateTimeKind.Local), new DateTime(DateTime.FromFileTimeUtc(structure.EndTime).Ticks, DateTimeKind.Local), structure.SampleCount);
            return(num);
        }
Ejemplo n.º 2
0
        public long SetQueryTimeRange(DateTime startTime, DateTime endTime)
        {
            PDH_TIME_INFO pInfo = new PDH_TIME_INFO();

            if ((startTime != DateTime.MinValue) && (startTime.Kind == DateTimeKind.Local))
            {
                startTime = new DateTime(startTime.Ticks, DateTimeKind.Utc);
            }
            pInfo.StartTime = (startTime == DateTime.MinValue) ? 0L : startTime.ToFileTimeUtc();
            if ((endTime != DateTime.MaxValue) && (endTime.Kind == DateTimeKind.Local))
            {
                endTime = new DateTime(endTime.Ticks, DateTimeKind.Utc);
            }
            pInfo.EndTime     = (endTime == DateTime.MaxValue) ? 0x7fffffffffffffffL : endTime.ToFileTimeUtc();
            pInfo.SampleCount = 0;
            return(PdhSetQueryTimeRange(this.m_hQuery, ref pInfo));
        }
Ejemplo n.º 3
0
 public long SetQueryTimeRange(DateTime startTime, DateTime endTime)
 {
     PDH_TIME_INFO pInfo = new PDH_TIME_INFO();
     if ((startTime != DateTime.MinValue) && (startTime.Kind == DateTimeKind.Local))
     {
         startTime = new DateTime(startTime.Ticks, DateTimeKind.Utc);
     }
     pInfo.StartTime = (startTime == DateTime.MinValue) ? 0L : startTime.ToFileTimeUtc();
     if ((endTime != DateTime.MaxValue) && (endTime.Kind == DateTimeKind.Local))
     {
         endTime = new DateTime(endTime.Ticks, DateTimeKind.Utc);
     }
     pInfo.EndTime = (endTime == DateTime.MaxValue) ? 0x7fffffffffffffffL : endTime.ToFileTimeUtc();
     pInfo.SampleCount = 0;
     return PdhSetQueryTimeRange(this.m_hQuery, ref pInfo);
 }
Ejemplo n.º 4
0
 private static extern long PdhSetQueryTimeRange(PdhSafeQueryHandle hQuery, ref PDH_TIME_INFO pInfo);
Ejemplo n.º 5
0
 private static extern long PdhGetDataSourceTimeRangeH(PdhSafeDataSourceHandle hDataSource, ref IntPtr pdwNumEntries, ref PDH_TIME_INFO pInfo, ref IntPtr pdwBufferSize);
Ejemplo n.º 6
0
 public long GetFilesSummary(out CounterFileInfo summary)
 {
     IntPtr pdwNumEntries = new IntPtr(0);
     PDH_TIME_INFO structure = new PDH_TIME_INFO();
     IntPtr pdwBufferSize = new IntPtr(Marshal.SizeOf(structure));
     long num = PdhGetDataSourceTimeRangeH(this.m_hDataSource, ref pdwNumEntries, ref structure, ref pdwBufferSize);
     if (num != 0)
     {
         summary = new CounterFileInfo();
         return num;
     }
     summary = new CounterFileInfo(new DateTime(DateTime.FromFileTimeUtc(structure.StartTime).Ticks, DateTimeKind.Local), new DateTime(DateTime.FromFileTimeUtc(structure.EndTime).Ticks, DateTimeKind.Local), structure.SampleCount);
     return num;
 }
Ejemplo n.º 7
0
        public uint SetQueryTimeRange(DateTime startTime, DateTime endTime)
        {
            Debug.Assert(_hQuery != null);
            Debug.Assert(endTime >= startTime);

            PDH_TIME_INFO pTimeInfo = new PDH_TIME_INFO();

            if (startTime != DateTime.MinValue && startTime.Kind == DateTimeKind.Local)
            {
                startTime = new DateTime(startTime.Ticks, DateTimeKind.Utc);
            }
            pTimeInfo.StartTime = (startTime == DateTime.MinValue) ? 0 : startTime.ToFileTimeUtc();

            if (endTime != DateTime.MaxValue && endTime.Kind == DateTimeKind.Local)
            {
                endTime = new DateTime(endTime.Ticks, DateTimeKind.Utc);
            }
            pTimeInfo.EndTime = (endTime == DateTime.MaxValue) ? Int64.MaxValue : endTime.ToFileTimeUtc();

            pTimeInfo.SampleCount = 0;

            return PdhSetQueryTimeRange(_hQuery, ref pTimeInfo);
        }
Ejemplo n.º 8
0
        public uint GetFilesSummary(out CounterFileInfo summary)
        {
            IntPtr pNumEntries = new IntPtr(0);
            PDH_TIME_INFO pInfo = new PDH_TIME_INFO();
            IntPtr bufSize = new IntPtr(System.Runtime.InteropServices.Marshal.SizeOf(pInfo));

            uint res = PdhGetDataSourceTimeRangeH(_hDataSource,
                                                    ref pNumEntries,
                                                    ref pInfo,
                                                    ref bufSize);
            if (res != 0)
            {
                summary = new CounterFileInfo();
                return res;
            }

            summary = new CounterFileInfo(new DateTime(DateTime.FromFileTimeUtc(pInfo.StartTime).Ticks, DateTimeKind.Local),
                                           new DateTime(DateTime.FromFileTimeUtc(pInfo.EndTime).Ticks, DateTimeKind.Local),
                                           pInfo.SampleCount);

            return res;
        }
Ejemplo n.º 9
0
 private static extern long PdhSetQueryTimeRange(PdhSafeQueryHandle hQuery, ref PDH_TIME_INFO pInfo);
Ejemplo n.º 10
0
 private static extern long PdhGetDataSourceTimeRangeH(PdhSafeDataSourceHandle hDataSource, ref IntPtr pdwNumEntries, ref PDH_TIME_INFO pInfo, ref IntPtr pdwBufferSize);