-
Notifications
You must be signed in to change notification settings - Fork 7
/
CPUInfo.h
48 lines (42 loc) · 1.02 KB
/
CPUInfo.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
/*
* CPU History
* Christopher Bowns, 2008
*/
//
// CPUInfo.h
// CPU Usage
//
// Created by Peter Hosey on 2006-06-21.
// Copyright 2006 Peter Hosey. All rights reserved.
//
// Modified by Christopher Bowns, starting 2008-1-1.
#import <Cocoa/Cocoa.h>
#include <mach/mach.h>
#include <mach/processor_info.h>
#include <mach/mach_host.h>
typedef struct cpudata {
double user;
double sys;
double nice;
double idle;
} CPUData, *CPUDataPtr;
@interface CPUInfo : NSObject {
processor_cpu_load_info_t lastProcessorInfo;
mach_msg_type_number_t numLastProcessorInfo;
unsigned numCPUs;
CPUDataPtr *allcpudata;
int size;
int inptr;
int outptr;
}
- (CPUInfo *)initWithCapacity:(unsigned)numItems;
- (void)refresh;
- (unsigned)numCPUs;
- (void)startForwardIterate;
- (void)startBackwardIterate;
- (BOOL)getNext:(CPUDataPtr)ptr forCPU:(unsigned)cpu;
- (BOOL)getPrev:(CPUDataPtr)ptr forCPU:(unsigned)cpu;
- (void)getCurrent:(CPUDataPtr)ptr forCPU:(unsigned)cpu;
- (void)getLast:(CPUDataPtr)ptr forCPU:(unsigned)cpu;
- (int)getSize;
@end