forked from chockenberry/iPulse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProcessorInfo.h
executable file
·54 lines (45 loc) · 1.04 KB
/
ProcessorInfo.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
//
// ProcessorInfo.m - Processor Usage History Container Class
//
#import <Cocoa/Cocoa.h>
#import <mach/mach.h>
#import <mach/mach_types.h>
//#define MAX_PROCESSORS 2
#define MAX_PROCESSORS 8
typedef struct cpustats
{
int processorCount;
unsigned long system[MAX_PROCESSORS];
unsigned long user[MAX_PROCESSORS];
unsigned long nice[MAX_PROCESSORS];
unsigned long idle[MAX_PROCESSORS];
} cpustats_t;
typedef struct cpudata
{
double userTotal;
double systemTotal;
double niceTotal;
double idleTotal;
int processorCount;
double system[MAX_PROCESSORS];
double user[MAX_PROCESSORS];
double nice[MAX_PROCESSORS];
double idle[MAX_PROCESSORS];
} CPUData, *CPUDataPtr;
@interface ProcessorInfo : NSObject
{
int size;
int inptr;
int outptr;
CPUDataPtr cpudata;
host_cpu_load_info_data_t lastcpustat;
cpustats_t newlastcpustat;
}
- (ProcessorInfo *)initWithCapacity:(unsigned)numItems;
- (void)refresh;
- (void)startIterate;
- (BOOL)getNext:(CPUDataPtr)ptr;
- (void)getCurrent:(CPUDataPtr)ptr;
- (void)getLast:(CPUDataPtr)ptr;
- (int)getSize;
@end