Initial revision
This commit is contained in:
1 parent
1a7957fb1e
commit
dffe0da855
207 files changed
+34390
No files matched your search
Executable
+2
@@ -0,0 +1,2 @@
|
||||
@echo off
|
||||
cl -I..\..\..\include -I. -DWIN32 -DCPU_MAIN cpu.c /link ADVAPI32.LIB
|
||||
@@ -0,0 +1,820 @@
|
||||
#counter names from registry key
|
||||
#SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Perflib
|
||||
0 UNDEFINED
|
||||
1 1847
|
||||
2 System
|
||||
4 Memory
|
||||
6 % Processor Time
|
||||
10 File Read Operations/sec
|
||||
12 File Write Operations/sec
|
||||
14 File Control Operations/sec
|
||||
16 File Read Bytes/sec
|
||||
18 File Write Bytes/sec
|
||||
20 File Control Bytes/sec
|
||||
24 Available Bytes
|
||||
26 Committed Bytes
|
||||
28 Page Faults/sec
|
||||
30 Commit Limit
|
||||
32 Write Copies/sec
|
||||
34 Transition Faults/sec
|
||||
36 Cache Faults/sec
|
||||
38 Demand Zero Faults/sec
|
||||
40 Pages/sec
|
||||
42 Page Reads/sec
|
||||
44 Processor Queue Length
|
||||
46 Thread State
|
||||
48 Pages Output/sec
|
||||
50 Page Writes/sec
|
||||
52 Browser
|
||||
54 Announcements Server/sec
|
||||
56 Pool Paged Bytes
|
||||
58 Pool Nonpaged Bytes
|
||||
60 Pool Paged Allocs
|
||||
64 Pool Nonpaged Allocs
|
||||
66 Pool Paged Resident Bytes
|
||||
68 System Code Total Bytes
|
||||
70 System Code Resident Bytes
|
||||
72 System Driver Total Bytes
|
||||
74 System Driver Resident Bytes
|
||||
76 System Cache Resident Bytes
|
||||
78 Announcements Domain/sec
|
||||
80 Election Packets/sec
|
||||
82 Mailslot Writes/sec
|
||||
84 Server List Requests/sec
|
||||
86 Cache
|
||||
88 Data Maps/sec
|
||||
90 Sync Data Maps/sec
|
||||
92 Async Data Maps/sec
|
||||
94 Data Map Hits %
|
||||
96 Data Map Pins/sec
|
||||
98 Pin Reads/sec
|
||||
100 Sync Pin Reads/sec
|
||||
102 Async Pin Reads/sec
|
||||
104 Pin Read Hits %
|
||||
106 Copy Reads/sec
|
||||
108 Sync Copy Reads/sec
|
||||
110 Async Copy Reads/sec
|
||||
112 Copy Read Hits %
|
||||
114 MDL Reads/sec
|
||||
116 Sync MDL Reads/sec
|
||||
118 Async MDL Reads/sec
|
||||
120 MDL Read Hits %
|
||||
122 Read Aheads/sec
|
||||
124 Fast Reads/sec
|
||||
126 Sync Fast Reads/sec
|
||||
128 Async Fast Reads/sec
|
||||
130 Fast Read Resource Misses/sec
|
||||
132 Fast Read Not Possibles/sec
|
||||
134 Lazy Write Flushes/sec
|
||||
136 Lazy Write Pages/sec
|
||||
138 Data Flushes/sec
|
||||
140 Data Flush Pages/sec
|
||||
142 % User Time
|
||||
144 % Privileged Time
|
||||
146 Context Switches/sec
|
||||
148 Interrupts/sec
|
||||
150 System Calls/sec
|
||||
152 Level 1 TLB Fills/sec
|
||||
154 Level 2 TLB Fills/sec
|
||||
156 Enumerations Server/sec
|
||||
158 Enumerations Domain/sec
|
||||
160 Enumerations Other/sec
|
||||
162 Missed Server Announcements
|
||||
164 Missed Mailslot Datagrams
|
||||
166 Missed Server List Requests
|
||||
168 Server Announce Allocations Failed/sec
|
||||
170 Mailslot Allocations Failed
|
||||
172 Virtual Bytes Peak
|
||||
174 Virtual Bytes
|
||||
178 Working Set Peak
|
||||
180 Working Set
|
||||
182 Page File Bytes Peak
|
||||
184 Page File Bytes
|
||||
186 Private Bytes
|
||||
188 Announcements Total/sec
|
||||
190 Enumerations Total/sec
|
||||
198 Current Disk Queue Length
|
||||
200 % Disk Time
|
||||
202 % Disk Read Time
|
||||
204 % Disk Write Time
|
||||
206 Avg. Disk sec/Transfer
|
||||
208 Avg. Disk sec/Read
|
||||
210 Avg. Disk sec/Write
|
||||
212 Disk Transfers/sec
|
||||
214 Disk Reads/sec
|
||||
216 Disk Writes/sec
|
||||
218 Disk Bytes/sec
|
||||
220 Disk Read Bytes/sec
|
||||
222 Disk Write Bytes/sec
|
||||
224 Avg. Disk Bytes/Transfer
|
||||
226 Avg. Disk Bytes/Read
|
||||
228 Avg. Disk Bytes/Write
|
||||
230 Process
|
||||
232 Thread
|
||||
234 PhysicalDisk
|
||||
236 LogicalDisk
|
||||
238 Processor
|
||||
240 % Total Processor Time
|
||||
242 % Total User Time
|
||||
244 % Total Privileged Time
|
||||
246 Total Interrupts/sec
|
||||
248 Processes
|
||||
250 Threads
|
||||
252 Events
|
||||
254 Semaphores
|
||||
256 Mutexes
|
||||
258 Sections
|
||||
260 Objects
|
||||
262 Redirector
|
||||
264 Bytes Received/sec
|
||||
266 Packets Received/sec
|
||||
268 Read Bytes Paging/sec
|
||||
270 Read Bytes Non-Paging/sec
|
||||
272 Read Bytes Cache/sec
|
||||
274 Read Bytes Network/sec
|
||||
276 Bytes Transmitted/sec
|
||||
278 Packets Transmitted/sec
|
||||
280 Write Bytes Paging/sec
|
||||
282 Write Bytes Non-Paging/sec
|
||||
284 Write Bytes Cache/sec
|
||||
286 Write Bytes Network/sec
|
||||
288 Read Operations/sec
|
||||
290 Read Operations Random/sec
|
||||
292 Read Packets/sec
|
||||
294 Reads Large/sec
|
||||
296 Read Packets Small/sec
|
||||
298 Write Operations/sec
|
||||
300 Write Operations Random/sec
|
||||
302 Write Packets/sec
|
||||
304 Writes Large/sec
|
||||
306 Write Packets Small/sec
|
||||
308 Reads Denied/sec
|
||||
310 Writes Denied/sec
|
||||
312 Network Errors/sec
|
||||
314 Server Sessions
|
||||
316 Server Reconnects
|
||||
318 Connects Core
|
||||
320 Connects Lan Manager 2.0
|
||||
322 Connects Lan Manager 2.1
|
||||
324 Connects Windows NT
|
||||
326 Server Disconnects
|
||||
328 Server Sessions Hung
|
||||
330 Server
|
||||
336 Thread Wait Reason
|
||||
340 Sessions Timed Out
|
||||
342 Sessions Errored Out
|
||||
344 Sessions Logged Off
|
||||
346 Sessions Forced Off
|
||||
348 Errors Logon
|
||||
350 Errors Access Permissions
|
||||
352 Errors Granted Access
|
||||
354 Errors System
|
||||
356 Blocking Requests Rejected
|
||||
358 Work Item Shortages
|
||||
360 Files Opened Total
|
||||
362 Files Open
|
||||
366 File Directory Searches
|
||||
370 Pool Nonpaged Failures
|
||||
372 Pool Nonpaged Peak
|
||||
376 Pool Paged Failures
|
||||
378 Pool Paged Peak
|
||||
388 Bytes Total/sec
|
||||
392 Current Commands
|
||||
398 NWLink NetBIOS
|
||||
400 Packets/sec
|
||||
404 Context Blocks Queued/sec
|
||||
406 File Data Operations/sec
|
||||
408 % Free Space
|
||||
410 Free Megabytes
|
||||
412 Connections Open
|
||||
414 Connections No Retries
|
||||
416 Connections With Retries
|
||||
418 Disconnects Local
|
||||
420 Disconnects Remote
|
||||
422 Failures Link
|
||||
424 Failures Adapter
|
||||
426 Connection Session Timeouts
|
||||
428 Connections Canceled
|
||||
430 Failures Resource Remote
|
||||
432 Failures Resource Local
|
||||
434 Failures Not Found
|
||||
436 Failures No Listen
|
||||
438 Datagrams/sec
|
||||
440 Datagram Bytes/sec
|
||||
442 Datagrams Sent/sec
|
||||
444 Datagram Bytes Sent/sec
|
||||
446 Datagrams Received/sec
|
||||
448 Datagram Bytes Received/sec
|
||||
452 Packets Sent/sec
|
||||
456 Frames/sec
|
||||
458 Frame Bytes/sec
|
||||
460 Frames Sent/sec
|
||||
462 Frame Bytes Sent/sec
|
||||
464 Frames Received/sec
|
||||
466 Frame Bytes Received/sec
|
||||
468 Frames Re-Sent/sec
|
||||
470 Frame Bytes Re-Sent/sec
|
||||
472 Frames Rejected/sec
|
||||
474 Frame Bytes Rejected/sec
|
||||
476 Expirations Response
|
||||
478 Expirations Ack
|
||||
480 Window Send Maximum
|
||||
482 Window Send Average
|
||||
484 Piggyback Ack Queued/sec
|
||||
486 Piggyback Ack Timeouts
|
||||
488 NWLink IPX
|
||||
490 NWLink SPX
|
||||
492 NetBEUI
|
||||
494 NetBEUI Resource
|
||||
496 Used Maximum
|
||||
498 Used Average
|
||||
500 Times Exhausted
|
||||
502 NBT Connection
|
||||
506 Bytes Sent/sec
|
||||
508 Total Bytes/sec
|
||||
510 Network Interface
|
||||
512 Bytes/sec
|
||||
520 Current Bandwidth
|
||||
524 Packets Received Unicast/sec
|
||||
526 Packets Received Non-Unicast/sec
|
||||
528 Packets Received Discarded
|
||||
530 Packets Received Errors
|
||||
532 Packets Received Unknown
|
||||
536 Packets Sent Unicast/sec
|
||||
538 Packets Sent Non-Unicast/sec
|
||||
540 Packets Outbound Discarded
|
||||
542 Packets Outbound Errors
|
||||
544 Output Queue Length
|
||||
546 IP
|
||||
552 Datagrams Received Header Errors
|
||||
554 Datagrams Received Address Errors
|
||||
556 Datagrams Forwarded/sec
|
||||
558 Datagrams Received Unknown Protocol
|
||||
560 Datagrams Received Discarded
|
||||
562 Datagrams Received Delivered/sec
|
||||
566 Datagrams Outbound Discarded
|
||||
568 Datagrams Outbound No Route
|
||||
570 Fragments Received/sec
|
||||
572 Fragments Re-assembled/sec
|
||||
574 Fragment Re-assembly Failures
|
||||
576 Fragmented Datagrams/sec
|
||||
578 Fragmentation Failures
|
||||
580 Fragments Created/sec
|
||||
582 ICMP
|
||||
584 Messages/sec
|
||||
586 Messages Received/sec
|
||||
588 Messages Received Errors
|
||||
590 Received Dest. Unreachable
|
||||
592 Received Time Exceeded
|
||||
594 Received Parameter Problem
|
||||
596 Received Source Quench
|
||||
598 Received Redirect/sec
|
||||
600 Received Echo/sec
|
||||
602 Received Echo Reply/sec
|
||||
604 Received Timestamp/sec
|
||||
606 Received Timestamp Reply/sec
|
||||
608 Received Address Mask
|
||||
610 Received Address Mask Reply
|
||||
612 Messages Sent/sec
|
||||
614 Messages Outbound Errors
|
||||
616 Sent Destination Unreachable
|
||||
618 Sent Time Exceeded
|
||||
620 Sent Parameter Problem
|
||||
622 Sent Source Quench
|
||||
624 Sent Redirect/sec
|
||||
626 Sent Echo/sec
|
||||
628 Sent Echo Reply/sec
|
||||
630 Sent Timestamp/sec
|
||||
632 Sent Timestamp Reply/sec
|
||||
634 Sent Address Mask
|
||||
636 Sent Address Mask Reply
|
||||
638 TCP
|
||||
640 Segments/sec
|
||||
642 Connections Established
|
||||
644 Connections Active
|
||||
646 Connections Passive
|
||||
648 Connection Failures
|
||||
650 Connections Reset
|
||||
652 Segments Received/sec
|
||||
654 Segments Sent/sec
|
||||
656 Segments Retransmitted/sec
|
||||
658 UDP
|
||||
660 % Total DPC Time
|
||||
662 % Total Interrupt Time
|
||||
664 Datagrams No Port/sec
|
||||
666 Datagrams Received Errors
|
||||
670 Disk Storage Unit
|
||||
672 Allocation Failures
|
||||
674 System Up Time
|
||||
676 System Handle Count
|
||||
678 Free System Page Table Entries
|
||||
680 Thread Count
|
||||
682 Priority Base
|
||||
684 Elapsed Time
|
||||
686 Alignment Fixups/sec
|
||||
688 Exception Dispatches/sec
|
||||
690 Floating Emulations/sec
|
||||
692 Logon/sec
|
||||
694 Priority Current
|
||||
696 % DPC Time
|
||||
698 % Interrupt Time
|
||||
700 Paging File
|
||||
702 % Usage
|
||||
704 % Usage Peak
|
||||
706 Start Address
|
||||
708 User PC
|
||||
710 Mapped Space No Access
|
||||
712 Mapped Space Read Only
|
||||
714 Mapped Space Read/Write
|
||||
716 Mapped Space Write Copy
|
||||
718 Mapped Space Executable
|
||||
720 Mapped Space Exec Read Only
|
||||
722 Mapped Space Exec Read/Write
|
||||
724 Mapped Space Exec Write Copy
|
||||
726 Reserved Space No Access
|
||||
728 Reserved Space Read Only
|
||||
730 Reserved Space Read/Write
|
||||
732 Reserved Space Write Copy
|
||||
734 Reserved Space Executable
|
||||
736 Reserved Space Exec Read Only
|
||||
738 Reserved Space Exec Read/Write
|
||||
740 Image
|
||||
742 Reserved Space Exec Write Copy
|
||||
744 Unassigned Space No Access
|
||||
746 Unassigned Space Read Only
|
||||
748 Unassigned Space Read/Write
|
||||
750 Unassigned Space Write Copy
|
||||
752 Unassigned Space Executable
|
||||
754 Unassigned Space Exec Read Only
|
||||
756 Unassigned Space Exec Read/Write
|
||||
758 Unassigned Space Exec Write Copy
|
||||
760 Image Space No Access
|
||||
762 Image Space Read Only
|
||||
764 Image Space Read/Write
|
||||
766 Image Space Write Copy
|
||||
768 Image Space Executable
|
||||
770 Image Space Exec Read Only
|
||||
772 Image Space Exec Read/Write
|
||||
774 Image Space Exec Write Copy
|
||||
776 Bytes Image Reserved
|
||||
778 Bytes Image Free
|
||||
780 Bytes Reserved
|
||||
782 Bytes Free
|
||||
784 ID Process
|
||||
786 Process Address Space
|
||||
788 No Access
|
||||
790 Read Only
|
||||
792 Read/Write
|
||||
794 Write Copy
|
||||
796 Executable
|
||||
798 Exec Read Only
|
||||
800 Exec Read/Write
|
||||
802 Exec Write Copy
|
||||
804 ID Thread
|
||||
806 Mailslot Receives Failed
|
||||
808 Mailslot Writes Failed
|
||||
810 Mailslot Opens Failed/sec
|
||||
812 Duplicate Master Announcements
|
||||
814 Illegal Datagrams/sec
|
||||
816 Thread Details
|
||||
818 Cache Bytes
|
||||
820 Cache Bytes Peak
|
||||
822 Pages Input/sec
|
||||
870 RAS Port
|
||||
872 Bytes Transmitted
|
||||
874 Bytes Received
|
||||
876 Frames Transmitted
|
||||
878 Frames Received.
|
||||
880 Percent Compression Out
|
||||
882 Percent Compression In
|
||||
884 CRC Errors
|
||||
886 Timeout Errors
|
||||
888 Serial Overrun Errors
|
||||
890 Alignment Errors
|
||||
892 Buffer Overrun Errors
|
||||
894 Total Errors
|
||||
896 Bytes Transmitted/Sec
|
||||
898 Bytes Received/Sec
|
||||
900 Frames Transmitted/Sec
|
||||
902 Frames Received/Sec
|
||||
904 Total Errors/Sec
|
||||
906 RAS Total
|
||||
908 Total Connections
|
||||
920 WINS Server
|
||||
922 Unique Registrations/sec
|
||||
924 Group Registrations/sec
|
||||
926 Total Number of Registrations/sec
|
||||
928 Unique Renewals/sec
|
||||
930 Group Renewals/sec
|
||||
932 Total Number of Renewals/sec
|
||||
934 Releases/sec
|
||||
936 Queries/sec
|
||||
938 Unique Conflicts/sec
|
||||
940 Group Conflicts/sec
|
||||
942 Total Number of Conflicts/sec
|
||||
944 Successful Releases/sec
|
||||
946 Failed Releases/sec
|
||||
948 Successful Queries/sec
|
||||
950 Failed Queries/sec
|
||||
952 Handle Count
|
||||
1000 MacFile Server
|
||||
1002 Max Paged Memory
|
||||
1004 Current Paged Memory
|
||||
1006 Max NonPaged Memory
|
||||
1008 Current NonPaged memory
|
||||
1010 Current Sessions
|
||||
1012 Maximum Sessions
|
||||
1014 Current Files Open
|
||||
1016 Maximum Files Open
|
||||
1018 Failed Logons
|
||||
1020 Data Read/sec
|
||||
1022 Data Written/sec
|
||||
1024 Data Received/sec
|
||||
1026 Data Transmitted/sec
|
||||
1028 Current Queue Length
|
||||
1030 Maximum Queue Length
|
||||
1032 Current Threads
|
||||
1034 Maximum Threads
|
||||
1050 AppleTalk
|
||||
1052 Packets In/sec
|
||||
1054 Packets Out/sec
|
||||
1056 Bytes In/sec
|
||||
1058 Bytes Out/sec
|
||||
1060 Average Time/DDP Packet
|
||||
1062 DDP Packets/sec
|
||||
1064 Average Time/AARP Packet
|
||||
1066 AARP Packets/sec
|
||||
1068 Average Time/ATP Packet
|
||||
1070 ATP Packets/sec
|
||||
1072 Average Time/NBP Packet
|
||||
1074 NBP Packets/sec
|
||||
1076 Average Time/ZIP Packet
|
||||
1078 ZIP Packets/sec
|
||||
1080 Average Time/RTMP Packet
|
||||
1082 RTMP Packets/sec
|
||||
1084 ATP Retries Local
|
||||
1086 ATP Response Timouts
|
||||
1088 ATP XO Response/Sec
|
||||
1090 ATP ALO Response/Sec
|
||||
1092 ATP Recvd Release/Sec
|
||||
1094 Current NonPaged Pool
|
||||
1096 Packets Routed In/Sec
|
||||
1098 Packets dropped
|
||||
1100 ATP Retries Remote
|
||||
1102 Packets Routed Out/Sec
|
||||
1110 Network Segment
|
||||
1112 Total frames received/second
|
||||
1114 Total bytes received/second
|
||||
1116 Broadcast frames received/second
|
||||
1118 Multicast frames received/second
|
||||
1120 % Network utilization
|
||||
1124 % Broadcast Frames
|
||||
1126 % Multicast Frames
|
||||
1150 Telephony
|
||||
1152 Lines
|
||||
1154 Telephone Devices
|
||||
1156 Active Lines
|
||||
1158 Active Telephones
|
||||
1160 Outgoing Calls/sec
|
||||
1162 Incoming Calls/sec
|
||||
1164 Client Apps
|
||||
1166 Current Outgoing Calls
|
||||
1168 Current Incoming Calls
|
||||
1228 Gateway Service For NetWare
|
||||
1230 Client Service For NetWare
|
||||
1232 Packet Burst Read NCP Count/sec
|
||||
1234 Packet Burst Read Timeouts/sec
|
||||
1236 Packet Burst Write NCP Count/sec
|
||||
1238 Packet Burst Write Timeouts/sec
|
||||
1240 Packet Burst IO/sec
|
||||
1242 Connect NetWare 2.x
|
||||
1244 Connect NetWare 3.x
|
||||
1246 Connect NetWare 4.x
|
||||
1260 Logon Total
|
||||
1300 Server Work Queues
|
||||
1302 Queue Length
|
||||
1304 Active Threads
|
||||
1306 Available Threads
|
||||
1308 Available Work Items
|
||||
1310 Borrowed Work Items
|
||||
1312 Work Item Shortages
|
||||
1314 Current Clients
|
||||
1320 Bytes Transferred/sec
|
||||
1324 Read Bytes/sec
|
||||
1328 Write Bytes/sec
|
||||
1332 Total Operations/sec
|
||||
1334 DPCs Queued/sec
|
||||
1336 DPC Rate
|
||||
1342 Total DPCs Queued/sec
|
||||
1344 Total DPC Rate
|
||||
1350 % Registry Quota In Use
|
||||
1360 VL Memory
|
||||
1362 VLM % Virtual Size In Use
|
||||
1364 VLM Virtual Size
|
||||
1366 VLM Virtual Size Peak
|
||||
1368 VLM Virtual Size Available
|
||||
1370 VLM Commit Charge
|
||||
1372 VLM Commit Charge Peak
|
||||
1374 System VLM Commit Charge
|
||||
1376 System VLM Commit Charge Peak
|
||||
1378 System VLM Shared Commit Charge
|
||||
1380 Available KBytes
|
||||
1382 Available MBytes
|
||||
1400 Avg. Disk Queue Length
|
||||
1402 Avg. Disk Read Queue Length
|
||||
1404 Avg. Disk Write Queue Length
|
||||
1406 % Committed Bytes In Use
|
||||
1408 Full Image
|
||||
1410 Creating Process ID
|
||||
1412 IO Read Operations/sec
|
||||
1414 IO Write Operations/sec
|
||||
1416 IO Data Operations/sec
|
||||
1418 IO Other Operations/sec
|
||||
1420 IO Read Bytes/sec
|
||||
1422 IO Write Bytes/sec
|
||||
1424 IO Data Bytes/sec
|
||||
1426 IO Other Bytes/sec
|
||||
1450 Print Queue
|
||||
1452 Total Jobs Printed
|
||||
1454 Bytes Printed/sec
|
||||
1456 Total Pages Printed
|
||||
1458 Jobs
|
||||
1460 References
|
||||
1462 Max References
|
||||
1464 Jobs Spooling
|
||||
1466 Max Jobs Spooling
|
||||
1468 Out of Paper Errors
|
||||
1470 Not Ready Errors
|
||||
1472 Job Errors
|
||||
1474 Enumerate Network Printer Calls
|
||||
1476 Add Network Printer Calls
|
||||
1478 Working Set - Private
|
||||
1480 Working Set - Shared
|
||||
1482 % Idle Time
|
||||
1484 Split IO/Sec
|
||||
1500 Job Object
|
||||
1502 Current % Processor Time
|
||||
1504 Current % User Mode Time
|
||||
1506 Current % Kernel Mode Time
|
||||
1508 This Period mSec - Processor
|
||||
1510 This Period mSec - User Mode
|
||||
1512 This Period mSec - Kernel Mode
|
||||
1514 Pages/Sec
|
||||
1516 Process Count - Total
|
||||
1518 Process Count - Active
|
||||
1520 Process Count - Terminated
|
||||
1522 Total mSec - Processor
|
||||
1524 Total mSec - User Mode
|
||||
1526 Total mSec - Kernel Mode
|
||||
1548 Job Object Details
|
||||
1746 % Idle Time
|
||||
1748 % C1 Time
|
||||
1750 % C2 Time
|
||||
1752 % C3 Time
|
||||
1754 C1 Transitions/sec
|
||||
1756 C2 Transitions/sec
|
||||
1758 C3 Transitions/sec
|
||||
1760 Heap
|
||||
1762 Committed Bytes
|
||||
1764 Reserved Bytes
|
||||
1766 Virtual Bytes
|
||||
1768 Free Bytes
|
||||
1770 Free List Length
|
||||
1772 Avg. alloc rate
|
||||
1774 Avg. free rate
|
||||
1776 Uncommitted Ranges Length
|
||||
1778 Allocs - Frees
|
||||
1780 Cached Allocs/sec
|
||||
1782 Cached Frees/sec
|
||||
1784 Allocs <1K/sec
|
||||
1786 Frees <1K/sec
|
||||
1788 Allocs 1-8K/sec
|
||||
1790 Frees 1-8K/sec
|
||||
1792 Allocs over 8K/sec
|
||||
1794 Frees over 8K/sec
|
||||
1796 Total Allocs/sec
|
||||
1798 Total Frees/sec
|
||||
1800 Blocks in Heap Cache
|
||||
1802 Largest Cache Depth
|
||||
1804 % Fragmentation
|
||||
1806 % VAFragmentation
|
||||
1808 Heap Lock contention
|
||||
1846 End Marker
|
||||
1848 RSVP Service
|
||||
1850 Network Interfaces
|
||||
1852 Network sockets
|
||||
1854 Timers
|
||||
1856 RSVP sessions
|
||||
1858 QoS clients
|
||||
1860 QoS-enabled senders
|
||||
1862 QoS-enabled receivers
|
||||
1864 Failed QoS requests
|
||||
1866 Failed QoS sends
|
||||
1868 QoS notifications
|
||||
1870 Bytes in QoS notifications
|
||||
1872 RSVP Interfaces
|
||||
1874 Signaling bytes received
|
||||
1876 Signaling bytes sent
|
||||
1878 PATH messages received
|
||||
1880 RESV messages received
|
||||
1882 PATH ERR messages received
|
||||
1884 RESV ERR messages received
|
||||
1886 PATH TEAR messages received
|
||||
1888 RESV TEAR messages received
|
||||
1890 RESV CONFIRM messages received
|
||||
1892 PATH messages sent
|
||||
1894 RESV messages sent
|
||||
1896 PATH ERR messages sent
|
||||
1898 RESV ERR messages sent
|
||||
1900 PATH TEAR messages sent
|
||||
1902 RESV TEAR messages sent
|
||||
1904 RESV CONFIRM messages sent
|
||||
1906 Resource control failures
|
||||
1908 Policy control failures
|
||||
1910 General failures
|
||||
1912 Blocked RESVs
|
||||
1914 RESV state block timeouts
|
||||
1916 PATH state block timeouts
|
||||
1918 Send messages errors - Big messages
|
||||
1920 Receive messages errors - Big messages
|
||||
1922 Send messages errors - No memory
|
||||
1924 Receive messages errors - No memory
|
||||
1926 Number of incoming messages dropped
|
||||
1928 Number of outgoing messages dropped
|
||||
1930 Number of active flows
|
||||
1932 Reserved bandwidth
|
||||
1934 Maximum admitted bandwidth
|
||||
1936 PSched Flow
|
||||
1938 PSched Pipe
|
||||
1940 Packets dropped
|
||||
1942 Packets scheduled
|
||||
1944 Packets transmitted
|
||||
1946 Average packets in shaper
|
||||
1948 Max packets in shaper
|
||||
1950 Average packets in sequencer
|
||||
1952 Max packets in sequencer
|
||||
1954 Bytes scheduled
|
||||
1956 Bytes transmitted
|
||||
1958 Bytes transmitted/sec
|
||||
1960 Bytes scheduled/sec
|
||||
1962 Packets transmitted/sec
|
||||
1964 Packets scheduled/sec
|
||||
1966 Packets dropped/sec
|
||||
1968 Nonconforming packets scheduled
|
||||
1970 Nonconforming packets scheduled/sec
|
||||
1972 Nonconforming packets transmitted
|
||||
1974 Nonconforming packets transmitted/sec
|
||||
1976 Maximum Packets in netcard
|
||||
1978 Average Packets in netcard
|
||||
1980 Out of packets
|
||||
1982 Flows opened
|
||||
1984 Flows closed
|
||||
1986 Flows rejected
|
||||
1988 Flows modified
|
||||
1990 Flow mods rejected
|
||||
1992 Max simultaneous flows
|
||||
1994 Nonconforming packets scheduled
|
||||
1996 Nonconforming packets scheduled/sec
|
||||
1998 Nonconforming packets transmitted
|
||||
2000 Nonconforming packets transmitted/sec
|
||||
2002 Average packets in shaper
|
||||
2004 Max packets in shaper
|
||||
2006 Average packets in sequencer
|
||||
2008 Max packets in sequencer
|
||||
2010 Max packets in netcard
|
||||
2012 Average packets in netcard
|
||||
2014 RAS Port
|
||||
2016 Bytes Transmitted
|
||||
2018 Bytes Received
|
||||
2020 Frames Transmitted
|
||||
2022 Frames Received
|
||||
2024 Percent Compression Out
|
||||
2026 Percent Compression In
|
||||
2028 CRC Errors
|
||||
2030 Timeout Errors
|
||||
2032 Serial Overrun Errors
|
||||
2034 Alignment Errors
|
||||
2036 Buffer Overrun Errors
|
||||
2038 Total Errors
|
||||
2040 Bytes Transmitted/Sec
|
||||
2042 Bytes Received/Sec
|
||||
2044 Frames Transmitted/Sec
|
||||
2046 Frames Received/Sec
|
||||
2048 Total Errors/Sec
|
||||
2050 RAS Total
|
||||
2052 Total Connections
|
||||
2054 Terminal Services Session
|
||||
2056 Input WdBytes
|
||||
2058 Input WdFrames
|
||||
2060 Input WaitForOutBuf
|
||||
2062 Input Frames
|
||||
2064 Input Bytes
|
||||
2066 Input Compressed Bytes
|
||||
2068 Input Compress Flushes
|
||||
2070 Input Errors
|
||||
2072 Input Timeouts
|
||||
2074 Input Async Frame Error
|
||||
2076 Input Async Overrun
|
||||
2078 Input Async Overflow
|
||||
2080 Input Async Parity Error
|
||||
2082 Input Transport Errors
|
||||
2084 Output WdBytes
|
||||
2086 Output WdFrames
|
||||
2088 Output WaitForOutBuf
|
||||
2090 Output Frames
|
||||
2092 Output Bytes
|
||||
2094 Output Compressed Bytes
|
||||
2096 Output Compress Flushes
|
||||
2098 Output Errors
|
||||
2100 Output Timeouts
|
||||
2102 Output Async Frame Error
|
||||
2104 Output Async Overrun
|
||||
2106 Output Async Overflow
|
||||
2108 Output Async Parity Error
|
||||
2110 Output Transport Errors
|
||||
2112 Total WdBytes
|
||||
2114 Total WdFrames
|
||||
2116 Total WaitForOutBuf
|
||||
2118 Total Frames
|
||||
2120 Total Bytes
|
||||
2122 Total Compressed Bytes
|
||||
2124 Total Compress Flushes
|
||||
2126 Total Errors
|
||||
2128 Total Timeouts
|
||||
2130 Total Async Frame Error
|
||||
2132 Total Async Overrun
|
||||
2134 Total Async Overflow
|
||||
2136 Total Async Parity Error
|
||||
2138 Total Transport Errors
|
||||
2140 Total Protocol Cache Reads
|
||||
2142 Total Protocol Cache Hits
|
||||
2144 Total Protocol Cache Hit Ratio
|
||||
2146 Protocol Bitmap Cache Reads
|
||||
2148 Protocol Bitmap Cache Hits
|
||||
2150 Protocol Bitmap Cache Hit Ratio
|
||||
2152 Protocol Glyph Cache Reads
|
||||
2154 Protocol Glyph Cache Hits
|
||||
2156 Protocol Glyph Cache Hit Ratio
|
||||
2158 Protocol Brush Cache Reads
|
||||
2160 Protocol Brush Cache Hits
|
||||
2162 Protocol Brush Cache Hit Ratio
|
||||
2164 Protocol Save Screen Bitmap Cache Reads
|
||||
2166 Protocol Save Screen Bitmap Cache Hits
|
||||
2168 Protocol Save Screen Bitmap Cache Hit Ratio
|
||||
2170 Input Compression Ratio
|
||||
2172 Output Compression Ratio
|
||||
2174 Total Compression Ratio
|
||||
2176 Terminal Services
|
||||
2178 Total Sessions
|
||||
2180 Active Sessions
|
||||
2182 Inactive Sessions
|
||||
2184 Distributed Transaction Coordinator
|
||||
2186 Active Transactions
|
||||
2188 Committed Transactions
|
||||
2190 Aborted Transactions
|
||||
2192 In Doubt Transactions
|
||||
2194 Active Transactions Maximum
|
||||
2196 Force Committed Transactions
|
||||
2198 Force Aborted Transactions
|
||||
2200 Response Time -- Minimum
|
||||
2202 Response Time -- Average
|
||||
2204 Response Time -- Maximum
|
||||
2206 Transactions/sec
|
||||
2208 Committed Transactions/sec
|
||||
2210 Aborted Transactions/sec
|
||||
2212 Indexing Service
|
||||
2214 Word lists
|
||||
2216 Saved indexes
|
||||
2218 Index size (MB)
|
||||
2220 Files to be indexed
|
||||
2222 Unique keys
|
||||
2224 Running queries
|
||||
2226 Merge progress
|
||||
2228 # documents indexed
|
||||
2230 Total # documents
|
||||
2232 Total # of queries
|
||||
2234 Deferred for indexing
|
||||
2236 Indexing Service Filter
|
||||
2238 Total indexing speed (MB/hr)
|
||||
2240 Binding time (msec)
|
||||
2242 Indexing speed (MB/hr)
|
||||
2244 Http Indexing Service
|
||||
2246 Cache items
|
||||
2248 % Cache hits
|
||||
2250 Total cache accesses 1
|
||||
2252 % Cache misses
|
||||
2254 Total cache accesses 2
|
||||
2256 Active queries
|
||||
2258 Total queries
|
||||
2260 Queries per minute
|
||||
2262 Current requests queued
|
||||
2264 Total requests rejected
|
||||
2266 WMI Objects
|
||||
2268 HiPerf Classes
|
||||
2270 HiPerf Validity
|
||||
2272 BatteryStatus
|
||||
2274 ChargeRate
|
||||
2276 DischargeRate
|
||||
2278 RemainingCapacity
|
||||
2280 Tag
|
||||
2282 Voltage
|
||||
@@ -0,0 +1,354 @@
|
||||
/*
|
||||
* code in this file derived from:
|
||||
* http://www.intel.com/cd/ids/developer/asmo-na/eng/technologies/20438.htm
|
||||
* license grants use of the source code.
|
||||
*/
|
||||
static unsigned int HTSupported(void);
|
||||
static unsigned char LogicalProcPerPhysicalProc(unsigned int);
|
||||
static unsigned char GetAPIC_ID(unsigned int);
|
||||
static unsigned char CPUCount(unsigned char *, unsigned char *);
|
||||
|
||||
// EDX[28] Bit 28 is set if HT is supported
|
||||
#define HT_BIT 0x10000000
|
||||
|
||||
// EAX[11:8] Bit 8-11 contains family processor ID.
|
||||
#define FAMILY_ID 0x0F00
|
||||
|
||||
#define PENTIUM4_ID 0x0F00
|
||||
|
||||
// EAX[23:20] Bit 20-23 contains extended family processor ID
|
||||
#define EXT_FAMILY_ID 0x0F00000
|
||||
|
||||
|
||||
// EBX[23:16] Bit 16-23 in ebx contains the number of logical
|
||||
// processors per physical processor when execute cpuid with
|
||||
// eax set to 1
|
||||
#define NUM_LOGICAL_BITS 0x00FF0000
|
||||
|
||||
// EBX[31:24] Bits 24-31 (8 bits) return the 8-bit unique
|
||||
// initial APIC ID for the processor this code is running on.
|
||||
// Default value = 0xff if HT is not supported
|
||||
#define INITIAL_APIC_ID_BITS 0xFF000000
|
||||
|
||||
// Status Flag
|
||||
#define HT_NOT_CAPABLE 0
|
||||
#define HT_ENABLED 1
|
||||
#define HT_DISABLED 2
|
||||
#define HT_SUPPORTED_NOT_ENABLED 3
|
||||
#define HT_CANNOT_DETECT 4
|
||||
|
||||
#include "sigar.h"
|
||||
#include "sigar_private.h"
|
||||
#include "sigar_os.h"
|
||||
|
||||
static unsigned int HTSupported(void)
|
||||
{
|
||||
unsigned int
|
||||
Regedx = 0,
|
||||
Regeax = 0,
|
||||
VendorId[3] = {0, 0, 0};
|
||||
|
||||
__try {
|
||||
__asm {
|
||||
xor eax, eax // call cpuid with eax = 0
|
||||
cpuid // Get vendor id string
|
||||
mov VendorId, ebx
|
||||
mov VendorId + 4, edx
|
||||
mov VendorId + 8, ecx
|
||||
|
||||
mov eax, 1 // call cpuid with eax = 1
|
||||
cpuid
|
||||
mov Regeax, eax // eax contains family processor type
|
||||
mov Regedx, edx // edx has info about the availability of hyper-Threading
|
||||
}
|
||||
}
|
||||
__except (EXCEPTION_EXECUTE_HANDLER) {
|
||||
return 0; // cpuid is unavailable
|
||||
}
|
||||
|
||||
if (((Regeax & FAMILY_ID) == PENTIUM4_ID) ||
|
||||
(Regeax & EXT_FAMILY_ID))
|
||||
{
|
||||
if ((VendorId[0] == 'uneG') &&
|
||||
(VendorId[1] == 'Ieni') &&
|
||||
(VendorId[2] == 'letn'))
|
||||
{
|
||||
// Genuine Intel with hyper-Threading technology
|
||||
return Regedx & HT_BIT;
|
||||
}
|
||||
}
|
||||
|
||||
return 0; // Not genuine Intel processor
|
||||
}
|
||||
|
||||
static unsigned char LogicalProcPerPhysicalProc(unsigned int ht_supported)
|
||||
{
|
||||
unsigned int Regebx = 0;
|
||||
if (!ht_supported) {
|
||||
return (unsigned char) 1; // HT not supported
|
||||
}
|
||||
|
||||
// Logical processor = 1
|
||||
__asm {
|
||||
mov eax, 1
|
||||
cpuid
|
||||
mov Regebx, ebx
|
||||
}
|
||||
|
||||
return (unsigned char) ((Regebx & NUM_LOGICAL_BITS) >> 16);
|
||||
}
|
||||
|
||||
static unsigned char GetAPIC_ID(unsigned int ht_supported)
|
||||
{
|
||||
unsigned int Regebx = 0;
|
||||
if (!ht_supported) {
|
||||
return (unsigned char) -1;
|
||||
}
|
||||
|
||||
// Logical processor = 1
|
||||
__asm {
|
||||
mov eax, 1
|
||||
cpuid
|
||||
mov Regebx, ebx
|
||||
}
|
||||
|
||||
return (unsigned char) ((Regebx & INITIAL_APIC_ID_BITS) >> 24);
|
||||
}
|
||||
|
||||
static unsigned char CPUCount(unsigned char *LogicalNum,
|
||||
unsigned char *PhysicalNum)
|
||||
{
|
||||
unsigned int ht_supported = HTSupported();
|
||||
unsigned char StatusFlag = 0;
|
||||
SYSTEM_INFO info;
|
||||
|
||||
*PhysicalNum = 0;
|
||||
*LogicalNum = 0;
|
||||
info.dwNumberOfProcessors = 0;
|
||||
GetSystemInfo(&info);
|
||||
|
||||
// Number of physical processors in a non-Intel system
|
||||
// or in a 32-bit Intel system with Hyper-Threading technology disabled
|
||||
*PhysicalNum = (unsigned char) info.dwNumberOfProcessors;
|
||||
|
||||
if (ht_supported) {
|
||||
unsigned char HT_Enabled = 0;
|
||||
|
||||
*LogicalNum = LogicalProcPerPhysicalProc(ht_supported);
|
||||
|
||||
if (*LogicalNum >= 1) { // >1 Doesn't mean HT is enabled in the BIOS
|
||||
HANDLE hCurrentProcessHandle;
|
||||
DWORD dwProcessAffinity;
|
||||
DWORD dwSystemAffinity;
|
||||
DWORD dwAffinityMask;
|
||||
|
||||
// Calculate the appropriate shifts and mask based on the
|
||||
// number of logical processors.
|
||||
|
||||
unsigned char i = 1,
|
||||
PHY_ID_MASK = 0xFF,
|
||||
PHY_ID_SHIFT = 0;
|
||||
|
||||
while (i < *LogicalNum) {
|
||||
i *= 2;
|
||||
PHY_ID_MASK <<= 1;
|
||||
PHY_ID_SHIFT++;
|
||||
}
|
||||
|
||||
hCurrentProcessHandle = GetCurrentProcess();
|
||||
|
||||
GetProcessAffinityMask(hCurrentProcessHandle,
|
||||
&dwProcessAffinity,
|
||||
&dwSystemAffinity);
|
||||
|
||||
// Check if available process affinity mask is equal to the
|
||||
// available system affinity mask
|
||||
if (dwProcessAffinity != dwSystemAffinity) {
|
||||
StatusFlag = HT_CANNOT_DETECT;
|
||||
// *PhysicalNum = (unsigned char)-1;
|
||||
return StatusFlag;
|
||||
}
|
||||
|
||||
dwAffinityMask = 1;
|
||||
|
||||
while (dwAffinityMask != 0 && dwAffinityMask <= dwProcessAffinity) {
|
||||
// Check if this CPU is available
|
||||
if (dwAffinityMask & dwProcessAffinity) {
|
||||
if (SetProcessAffinityMask(hCurrentProcessHandle,
|
||||
dwAffinityMask))
|
||||
{
|
||||
unsigned char APIC_ID,
|
||||
LOG_ID,
|
||||
PHY_ID;
|
||||
|
||||
Sleep(0); // Give OS time to switch CPU
|
||||
|
||||
APIC_ID = GetAPIC_ID(ht_supported);
|
||||
LOG_ID = APIC_ID & ~PHY_ID_MASK;
|
||||
PHY_ID = APIC_ID >> PHY_ID_SHIFT;
|
||||
|
||||
if (LOG_ID != 0) {
|
||||
HT_Enabled = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dwAffinityMask = dwAffinityMask << 1;
|
||||
}
|
||||
|
||||
// Reset the processor affinity
|
||||
SetProcessAffinityMask(hCurrentProcessHandle, dwProcessAffinity);
|
||||
|
||||
if (*LogicalNum == 1) { // Normal P4 : HT is disabled in hardware
|
||||
StatusFlag = HT_DISABLED;
|
||||
}
|
||||
else {
|
||||
if (HT_Enabled) {
|
||||
// Total physical processors in a Hyper-Threading enabled system.
|
||||
*PhysicalNum /= (*LogicalNum);
|
||||
StatusFlag = HT_ENABLED;
|
||||
}
|
||||
else {
|
||||
StatusFlag = HT_SUPPORTED_NOT_ENABLED;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
// Processors do not have Hyper-Threading technology
|
||||
StatusFlag = HT_NOT_CAPABLE;
|
||||
*LogicalNum = 1;
|
||||
}
|
||||
|
||||
return StatusFlag;
|
||||
}
|
||||
|
||||
unsigned int sigar_cpu_count(sigar_t *sigar)
|
||||
{
|
||||
unsigned char
|
||||
status,
|
||||
LogicalNum = 0,
|
||||
PhysicalNum = 0;
|
||||
|
||||
if (sigar->ncpu != 0) {
|
||||
return sigar->ncpu;
|
||||
}
|
||||
|
||||
status = CPUCount(&LogicalNum, &PhysicalNum);
|
||||
|
||||
sigar->ncpu = (unsigned int)PhysicalNum;
|
||||
|
||||
if (status == HT_ENABLED) {
|
||||
sigar->ht_enabled = 1;
|
||||
}
|
||||
else {
|
||||
sigar->ht_enabled = 0;
|
||||
}
|
||||
|
||||
return sigar->ncpu;
|
||||
}
|
||||
|
||||
/* this function is not part of the intel derived code */
|
||||
|
||||
int sigar_cpu_info_get(sigar_t *sigar, sigar_cpu_info_t *info)
|
||||
{
|
||||
HKEY key, cpu;
|
||||
int i = 0;
|
||||
TCHAR id[MAX_PATH + 1];
|
||||
LPBYTE value;
|
||||
DWORD size = 0, rc;
|
||||
|
||||
RegOpenKey(HKEY_LOCAL_MACHINE,
|
||||
"HARDWARE\\DESCRIPTION\\System\\CentralProcessor", &key);
|
||||
|
||||
//just lookup the first id, then assume all cpus are the same.
|
||||
rc = RegEnumKey(key, 0, id, sizeof(id));
|
||||
if (rc != ERROR_SUCCESS) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = RegOpenKey(key, id, &cpu);
|
||||
if (rc != ERROR_SUCCESS) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
size = sizeof(info->vendor);
|
||||
if (RegQueryValueEx(cpu, "VendorIdentifier", NULL, NULL,
|
||||
(LPVOID)&info->vendor, &size))
|
||||
{
|
||||
SIGAR_SSTRCPY(info->vendor, "Intel");
|
||||
}
|
||||
|
||||
size = sizeof(info->model);
|
||||
if (RegQueryValueEx(cpu, "Identifier", NULL, NULL,
|
||||
(LPVOID)&info->model, &size))
|
||||
{
|
||||
SIGAR_SSTRCPY(info->vendor, "x86");
|
||||
}
|
||||
|
||||
size = sizeof(info->mhz); // == sizeof(DWORD)
|
||||
if (RegQueryValueEx(cpu, "~MHz", NULL, NULL,
|
||||
(LPVOID)&info->mhz, &size))
|
||||
{
|
||||
info->mhz = -1;
|
||||
}
|
||||
|
||||
info->cache_size = -1; //XXX
|
||||
|
||||
return SIGAR_OK;
|
||||
}
|
||||
|
||||
#ifdef CPU_MAIN
|
||||
void main(void)
|
||||
{
|
||||
// Number of logical CPU per ONE PHYSICAL CPU
|
||||
unsigned char LogicalNum = 0,
|
||||
PhysicalNum = 0, // Total number of physical processor
|
||||
HTStatusFlag = 0;
|
||||
|
||||
sigar_cpu_info_t info;
|
||||
|
||||
sigar_cpu_info_get(NULL, &info);
|
||||
|
||||
printf("Vendor............%s\n", info.vendor);
|
||||
printf("Model.............%s\n", info.model);
|
||||
printf("Mhz...............%d\n", info.mhz);
|
||||
|
||||
HTStatusFlag = CPUCount(&LogicalNum, &PhysicalNum);
|
||||
|
||||
switch(HTStatusFlag)
|
||||
{
|
||||
case HT_NOT_CAPABLE:
|
||||
printf("Hyper-threading...not capable\n");
|
||||
break;
|
||||
|
||||
case HT_DISABLED:
|
||||
printf("Hyper-threading...disabled\n");
|
||||
break;
|
||||
|
||||
case HT_ENABLED:
|
||||
printf("Hyper-threading...enabled\n");
|
||||
break;
|
||||
|
||||
case HT_SUPPORTED_NOT_ENABLED:
|
||||
printf("Hyper-threading...capable but not enabled\n");
|
||||
break;
|
||||
|
||||
case HT_CANNOT_DETECT:
|
||||
printf("Hyper-threading...cannot be detected\n");
|
||||
break;
|
||||
}
|
||||
|
||||
printf("Logical ratio.....%d/1\n",
|
||||
LogicalNum);
|
||||
|
||||
if (PhysicalNum != (unsigned char)-1) {
|
||||
printf("Physical CPUs.....%d\n", PhysicalNum);
|
||||
}
|
||||
else {
|
||||
printf("Can't determine number of physical processors\n");
|
||||
printf("Make sure to enable ALL processors\n");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* functions for getting info from the Process Environment Block
|
||||
*/
|
||||
#define UNICODE
|
||||
#define _UNICODE
|
||||
|
||||
#include "sigar.h"
|
||||
#include "sigar_private.h"
|
||||
#include "sigar_os.h"
|
||||
|
||||
#define START_ADDRESS (LPVOID)0x00020498
|
||||
|
||||
static int sigar_peb_get(sigar_t *sigar, HANDLE proc, DWORD *base)
|
||||
{
|
||||
MEMORY_BASIC_INFORMATION mbi;
|
||||
DWORD bytes;
|
||||
|
||||
if (!sigar->peb) {
|
||||
sigar->peb = malloc(sigar->pagesize);
|
||||
}
|
||||
|
||||
if (!VirtualQueryEx(proc, START_ADDRESS, &mbi, sizeof(mbi))) {
|
||||
return GetLastError();
|
||||
}
|
||||
|
||||
if (!ReadProcessMemory(proc, mbi.BaseAddress, sigar->peb,
|
||||
sigar->pagesize, &bytes))
|
||||
{
|
||||
return GetLastError();
|
||||
}
|
||||
|
||||
*base = (DWORD)mbi.BaseAddress;
|
||||
|
||||
return SIGAR_OK;
|
||||
}
|
||||
|
||||
//point scratch to PATH env var
|
||||
#define PEB_PATH(scratch, base) \
|
||||
scratch = sigar->peb + ((DWORD)START_ADDRESS - base)
|
||||
|
||||
//point scratch to EXE (assumes PEB_PATH)
|
||||
#define PEB_EXE(scratch) \
|
||||
scratch = scratch + (wcslen((LPWSTR)scratch) + 1) * sizeof(WCHAR)
|
||||
|
||||
int sigar_proc_exe_name_get(sigar_t *sigar, HANDLE proc, char *name)
|
||||
{
|
||||
int status;
|
||||
LPBYTE scratch;
|
||||
DWORD base;
|
||||
WCHAR buf[MAX_PATH];
|
||||
|
||||
if ((status = sigar_peb_get(sigar, proc, &base)) != SIGAR_OK) {
|
||||
return status;
|
||||
}
|
||||
|
||||
//skip env PATH
|
||||
PEB_PATH(scratch, base);
|
||||
|
||||
PEB_EXE(scratch);
|
||||
|
||||
//seems common, reason unknown.
|
||||
if (*scratch == '\0') {
|
||||
scratch += sizeof(WCHAR);
|
||||
}
|
||||
|
||||
wcsncpy(buf, (LPWSTR)scratch, MAX_PATH);
|
||||
buf[MAX_PATH-1] = L'\0';
|
||||
|
||||
SIGAR_W2A(buf, name, MAX_PATH);
|
||||
|
||||
return SIGAR_OK;
|
||||
}
|
||||
@@ -0,0 +1,125 @@
|
||||
#ifndef SIGAR_OS_H
|
||||
#define SIGAR_OS_H
|
||||
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <winreg.h>
|
||||
#include <winperf.h>
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
#include <stddef.h>
|
||||
#include <sys/types.h>
|
||||
#include <malloc.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
|
||||
#define INT64_C(val) val##i64
|
||||
|
||||
/* see apr/include/arch/win32/atime.h */
|
||||
#define EPOCH_DELTA INT64_C(11644473600000000)
|
||||
|
||||
static __inline sigar_uint64_t FileTimeToTime(FILETIME *ft)
|
||||
{
|
||||
sigar_uint64_t time;
|
||||
time = ft->dwHighDateTime;
|
||||
time = time << 32;
|
||||
time |= ft->dwLowDateTime;
|
||||
time /= 10;
|
||||
time -= EPOCH_DELTA;
|
||||
return time;
|
||||
}
|
||||
|
||||
/* XXX: support CP_UTF8 ? */
|
||||
|
||||
#define SIGAR_A2W(lpa, lpw, bytes) \
|
||||
(lpw[0] = 0, MultiByteToWideChar(CP_ACP, 0, \
|
||||
lpa, -1, lpw, (bytes/sizeof(WCHAR))))
|
||||
|
||||
#define SIGAR_W2A(lpw, lpa, chars) \
|
||||
(lpa[0] = '\0', WideCharToMultiByte(CP_ACP, 0, \
|
||||
lpw, -1, (LPSTR)lpa, chars, \
|
||||
NULL, NULL))
|
||||
|
||||
#include <iprtrmib.h>
|
||||
|
||||
/* undocumented structures */
|
||||
typedef struct {
|
||||
DWORD dwState;
|
||||
DWORD dwLocalAddr;
|
||||
DWORD dwLocalPort;
|
||||
DWORD dwRemoteAddr;
|
||||
DWORD dwRemotePort;
|
||||
DWORD dwProcessId;
|
||||
} MIB_TCPEXROW, *PMIB_TCPEXROW;
|
||||
|
||||
typedef struct {
|
||||
DWORD dwNumEntries;
|
||||
MIB_TCPEXROW table[ANY_SIZE];
|
||||
} MIB_TCPEXTABLE, *PMIB_TCPEXTABLE;
|
||||
|
||||
typedef struct {
|
||||
DWORD dwLocalAddr;
|
||||
DWORD dwLocalPort;
|
||||
DWORD dwProcessId;
|
||||
} MIB_UDPEXROW, *PMIB_UDPEXROW;
|
||||
|
||||
typedef struct {
|
||||
DWORD dwNumEntries;
|
||||
MIB_UDPEXROW table[ANY_SIZE];
|
||||
} MIB_UDPEXTABLE, *PMIB_UDPEXTABLE;
|
||||
|
||||
/* end undocumented structures */
|
||||
|
||||
typedef DWORD (CALLBACK *LPGETIPFORWARDTABLE)(PMIB_IPFORWARDTABLE, PULONG, BOOL);
|
||||
|
||||
typedef DWORD (CALLBACK *LPGETIFTABLE)(PMIB_IFTABLE, PULONG, BOOL);
|
||||
|
||||
typedef DWORD (CALLBACK *LPGETTCPTABLE)(PMIB_TCPTABLE, PDWORD, BOOL);
|
||||
|
||||
typedef DWORD (CALLBACK *LPGETUDPTABLE)(PMIB_UDPTABLE, PDWORD, BOOL);
|
||||
|
||||
typedef DWORD (CALLBACK *LPGETTCPEXTABLE)(PMIB_TCPEXTABLE *, BOOL, HANDLE,
|
||||
DWORD, DWORD);
|
||||
|
||||
typedef struct {
|
||||
sigar_pid_t pid;
|
||||
int ppid;
|
||||
int priority;
|
||||
time_t mtime;
|
||||
sigar_uint64_t vsize;
|
||||
sigar_uint64_t size;
|
||||
char name[SIGAR_PROC_NAME_LEN];
|
||||
char state;
|
||||
sigar_uint64_t handles;
|
||||
} sigar_win32_pinfo_t;
|
||||
|
||||
struct sigar_t {
|
||||
SIGAR_T_BASE;
|
||||
char *machine;
|
||||
int using_wide;
|
||||
long pagesize;
|
||||
HKEY handle;
|
||||
char *perfbuf;
|
||||
DWORD perfbuf_size;
|
||||
HINSTANCE ip_handle;
|
||||
LPGETIFTABLE get_if_table;
|
||||
LPGETIPFORWARDTABLE get_ipforward_table;
|
||||
LPGETTCPTABLE get_tcp_table;
|
||||
LPGETTCPEXTABLE get_tcpx_table;
|
||||
LPGETUDPTABLE get_udp_table;
|
||||
sigar_win32_pinfo_t pinfo;
|
||||
WORD ws_version;
|
||||
int ws_error;
|
||||
LPBYTE peb; //scratch pad for getting peb info
|
||||
int ht_enabled;
|
||||
};
|
||||
|
||||
int sigar_wsa_init(sigar_t *sigar);
|
||||
|
||||
int sigar_proc_exe_name_get(sigar_t *sigar, HANDLE proc, char *name);
|
||||
|
||||
unsigned int sigar_cpu_count(sigar_t *sigar);
|
||||
|
||||
int sigar_cpu_info_get(sigar_t *sigar, sigar_cpu_info_t *info);
|
||||
|
||||
#endif /* SIGAR_OS_H */
|
||||
@@ -0,0 +1,31 @@
|
||||
#ifndef SIGAR_PDH_H
|
||||
#define SIGAR_PDH_H
|
||||
|
||||
/* performance data helpers */
|
||||
|
||||
#define PdhFirstObject(block) \
|
||||
((PERF_OBJECT_TYPE *)((BYTE *) block + block->HeaderLength))
|
||||
|
||||
#define PdhNextObject(object) \
|
||||
((PERF_OBJECT_TYPE *)((BYTE *) object + object->TotalByteLength))
|
||||
|
||||
#define PdhFirstCounter(object) \
|
||||
((PERF_COUNTER_DEFINITION *)((BYTE *) object + object->HeaderLength))
|
||||
|
||||
#define PdhNextCounter(counter) \
|
||||
((PERF_COUNTER_DEFINITION *)((BYTE *) counter + counter->ByteLength))
|
||||
|
||||
#define PdhGetCounterBlock(inst) \
|
||||
((PERF_COUNTER_BLOCK *)((BYTE *) inst + inst->ByteLength))
|
||||
|
||||
#define PdhFirstInstance(object) \
|
||||
((PERF_INSTANCE_DEFINITION *)((BYTE *) object + object->DefinitionLength))
|
||||
|
||||
#define PdhNextInstance(inst) \
|
||||
((PERF_INSTANCE_DEFINITION *)((BYTE *)inst + inst->ByteLength + \
|
||||
PdhGetCounterBlock(inst)->ByteLength))
|
||||
|
||||
#define PdhInstanceName(inst) \
|
||||
((wchar_t *)((BYTE *)inst + inst->NameOffset))
|
||||
|
||||
#endif /* SIGAR_PDH_H */
|
||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user