forked from MacFace/MacFace
-
Notifications
You must be signed in to change notification settings - Fork 0
/
HostStatistics.h
executable file
·84 lines (65 loc) · 1.66 KB
/
HostStatistics.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
//
// HostStatistics.h
// face
//
// Created by rryu on Fri Apr 05 2002.
// Copyright (c) 2001 __MyCompanyName__. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <mach/mach_types.h>
typedef struct {
unsigned long freePages;
unsigned long activePages;
unsigned long inactivePages;
unsigned long wirePages;
unsigned long faults;
unsigned long pageins;
unsigned long pageouts;
unsigned long pageinDelta;
unsigned long pageoutDelta;
} MemoryStats;
typedef struct {
float user;
float system;
float idle;
float nice;
} ProcessorUsage;
typedef struct {
unsigned long user;
unsigned long system;
unsigned long idle;
unsigned long nice;
} ProcessorTicks;
typedef struct {
ProcessorTicks ticks;
ProcessorUsage usage;
} ProcessorStats;
@interface HostStatistics : NSObject
{
mach_port_t hostPort;
mach_msg_type_number_t processorCount;
vm_size_t pageSize;
unsigned long totalPages;
unsigned long minUsedPages;
unsigned long maxUsedPages;
MemoryStats *memoryHistory;
ProcessorStats *totalProcessorHistory;
ProcessorStats *processorHistories;
int bufMaxLen;
int bufHead;
int bufTail;
int bufLen;
}
+ (NSString*)kernelVersion;
- (id)initWithCapacity:(unsigned)capacity;
- (void)update;
- (unsigned long)pageSize;
- (unsigned long)totalPages;
- (unsigned long)minUsedPages;
- (unsigned long)maxUsedPages;
- (int)processorCount;
- (int)length;
- (const MemoryStats*)memoryStatsIndexAt:(unsigned)index;
- (const ProcessorStats*)totalProcessorUsageIndexAt:(unsigned)index;
- (const ProcessorStats*)processorOf:(int)number usageIndexAt:(unsigned)index;
@end