forked from jpalmer/qtop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathqtop.h
51 lines (51 loc) · 1.18 KB
/
qtop.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
#define MAXCPUS 32
#define MINMAXCPUS 12
#define MAX_QUEUES 10
typedef struct node node;
typedef struct job job;
typedef struct user user;
typedef struct Que Que;
struct user
{
const char* name;
const char* realname;
const job* jobs;
job* jobsend;
int runcount;
int queuecount;
user * next;
};
struct node
{ //some example values
char up;
const char* name; //node23
int cores;//8
double loadave;//8.12734
long long int ramfree;//234178234 (measured in kb - use a long long in case we get 2TB of ram)
long long int physram;
job* users_using[MAXCPUS];
int users_using_count;
node* next;
char* props;
};
typedef enum {Q, R,C,S} jobstate;
struct job
{
int number;
jobstate state;
int corecount;
user* owner;
job* next;
job* usernext;
int secondsremaining;
char * queue;
long long int ramrequested;
int arrayid;
};
extern char* filternodes;
//not in .c file because it breaks syntax highlighting
#define findN(x,namein) \
({ typeof (x) t=x;\
typeof (x) ret=NULL;\
while(t!=NULL && t-> name != NULL){ if (!strcmp(namein,t->name)) {ret=t;break;}\
t=t->next;}ret;})