public
Description: OS X: displays recent CPU usage in the Dock or a floating window
Homepage: http://cbowns.com/cpuhistory/
Clone URL: git://github.com/cbowns/cpu-history.git
cpu-history / CPUInfo.h
100644 49 lines (42 sloc) 1.046 kb
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
/*
 *  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