htop/Process.h

173 lines
3.8 KiB
C
Raw Normal View History

2006-06-06 20:28:42 +00:00
/* Do not edit this file. It was automatically generated. */
2006-03-04 18:16:49 +00:00
#ifndef HEADER_Process
#define HEADER_Process
/*
htop - Process.h
(C) 2004-2014 Hisham H. Muhammad
2006-03-04 18:16:49 +00:00
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
// On Linux, this works only with glibc 2.1+. On earlier versions
2006-03-04 18:16:49 +00:00
// the behavior is similar to have a hardcoded page size.
#ifndef PAGE_SIZE
#define PAGE_SIZE ( sysconf(_SC_PAGESIZE) )
#endif
#define PAGE_SIZE_KB ( PAGE_SIZE / ONE_K )
2006-03-04 18:16:49 +00:00
2011-12-26 21:35:57 +00:00
#include "Object.h"
2011-12-26 21:35:57 +00:00
#include <sys/types.h>
2006-03-04 18:16:49 +00:00
#define PROCESS_FLAG_IO 0x0001
typedef enum ProcessFields {
PID = 1,
COMM = 2,
STATE = 3,
PPID = 4,
PGRP = 5,
SESSION = 6,
TTY_NR = 7,
TPGID = 8,
MINFLT = 10,
MAJFLT = 12,
PRIORITY = 18,
NICE = 19,
STARTTIME = 21,
2015-03-17 02:01:48 +00:00
PROCESSOR = 38,
M_SIZE = 39,
M_RESIDENT = 40,
ST_UID = 46,
PERCENT_CPU = 47,
PERCENT_MEM = 48,
USER = 49,
TIME = 50,
NLWP = 51,
TGID = 52,
} ProcessField;
2006-03-04 18:16:49 +00:00
typedef struct Process_ {
Object super;
struct Settings_* settings;
2006-03-04 18:16:49 +00:00
unsigned long long int time;
2010-02-25 01:43:18 +00:00
pid_t pid;
pid_t ppid;
pid_t tgid;
2006-03-04 18:16:49 +00:00
char* comm;
int indent;
int basenameOffset;
bool updated;
2006-03-04 18:16:49 +00:00
char state;
bool tag;
2010-06-17 19:02:03 +00:00
bool showChildren;
bool show;
unsigned int pgrp;
unsigned int session;
unsigned int tty_nr;
int tpgid;
uid_t st_uid;
2006-03-04 18:16:49 +00:00
unsigned long int flags;
2015-03-17 02:01:48 +00:00
int processor;
2014-02-27 19:35:22 +00:00
float percent_cpu;
float percent_mem;
char* user;
2006-03-04 18:16:49 +00:00
long int priority;
long int nice;
long int nlwp;
2010-03-29 18:36:11 +00:00
char starttime_show[8];
time_t starttime_ctime;
2014-02-27 19:35:22 +00:00
long m_size;
long m_resident;
2014-02-27 19:35:22 +00:00
int exit_signal;
unsigned long int minflt;
unsigned long int majflt;
2014-04-24 22:40:47 +00:00
#ifdef DEBUG
2014-02-27 19:35:22 +00:00
long int itrealvalue;
unsigned long int vsize;
long int rss;
unsigned long int rlim;
unsigned long int startcode;
unsigned long int endcode;
unsigned long int startstack;
unsigned long int kstkesp;
unsigned long int kstkeip;
unsigned long int signal;
unsigned long int blocked;
unsigned long int sigignore;
unsigned long int sigcatch;
unsigned long int wchan;
unsigned long int nswap;
unsigned long int cnswap;
#endif
2006-03-04 18:16:49 +00:00
} Process;
typedef struct ProcessFieldData_ {
const char* name;
const char* title;
const char* description;
int flags;
} ProcessFieldData;
2006-03-04 18:16:49 +00:00
// Implemented in platform-specific code:
void Process_setupColumnWidths();
void Process_writeField(Process* this, RichString* str, ProcessField field);
long Process_compare(const void* v1, const void* v2);
void Process_delete(Object* cast);
bool Process_isThread(Process* this);
extern ProcessFieldData Process_fields[];
extern char* Process_pidFormat;
extern char* Process_tpgidFormat;
2006-03-04 18:16:49 +00:00
2015-03-17 02:01:48 +00:00
typedef Process*(*Process_new_fn)(struct Settings_*);
#define ONE_K 1024L
#define ONE_M (ONE_K * ONE_K)
#define ONE_G (ONE_M * ONE_K)
2006-03-04 18:16:49 +00:00
#define ONE_DECIMAL_K 1000L
2014-02-27 19:35:22 +00:00
#define ONE_DECIMAL_M (ONE_DECIMAL_K * ONE_DECIMAL_K)
#define ONE_DECIMAL_G (ONE_DECIMAL_M * ONE_DECIMAL_K)
2014-02-27 19:35:22 +00:00
void Process_humanNumber(RichString* str, unsigned long number, bool coloring);
void Process_colorNumber(RichString* str, unsigned long long number, bool coloring);
2015-03-17 02:01:48 +00:00
void Process_printTime(RichString* str, unsigned long long totalHundredths);
void Process_outputRate(RichString* str, char* buffer, int n, double rate, int coloring);
void Process_writeDefaultField(Process* this, RichString* str, ProcessField field);
void Process_done(Process* this);
2006-03-04 18:16:49 +00:00
extern ObjectClass Process_class;
void Process_init(Process* this, struct Settings_* settings);
2006-03-04 18:16:49 +00:00
void Process_toggleTag(Process* this);
bool Process_setPriority(Process* this, int priority);
2006-03-04 18:16:49 +00:00
2012-10-04 23:59:45 +00:00
bool Process_changePriorityBy(Process* this, size_t delta);
void Process_sendSignal(Process* this, size_t sgn);
2006-03-04 18:16:49 +00:00
2014-04-25 22:41:23 +00:00
long Process_pidCompare(const void* v1, const void* v2);
long Process_defaultCompare(const void* v1, const void* v2);
2006-03-04 18:16:49 +00:00
#endif