* make debug target

* Support for generating a /proc trace for debugging purposes.
This commit is contained in:
Hisham Muhammad
2006-03-24 03:39:04 +00:00
parent a3a8a3b24b
commit 86d6313560
3 changed files with 151 additions and 39 deletions

View File

@ -1,14 +1,19 @@
/* Do not edit this file. It was automatically genarated. */
/* Do not edit this file. It was automatically generated. */
#ifndef HEADER_ProcessList
#define HEADER_ProcessList
/*
htop - ProcessList.h
(C) 2004-2006 Hisham H. Muhammad
htop - ProcessList.c
(C) 2004,2005 Hisham H. Muhammad
Released under the GNU GPL, see the COPYING file
in the source distribution for its full text.
*/
#ifndef CONFIG_H
#define CONFIG_H
#include "config.h"
#endif
#include "Process.h"
#include "TypedVector.h"
#include "UsersTable.h"
@ -23,6 +28,7 @@ in the source distribution for its full text.
#include <signal.h>
#include <stdbool.h>
#include <sys/utsname.h>
#include <stdarg.h>
#include "debug.h"
#include <assert.h>
@ -43,6 +49,12 @@ in the source distribution for its full text.
#define MAX_NAME 128
#endif
#ifndef MAX_READ
#define MAX_READ 8192
#endif
typedef struct ProcessList_ {
TypedVector* processes;
TypedVector* processes2;
@ -75,11 +87,6 @@ typedef struct ProcessList_ {
long int usedSwap;
long int freeSwap;
int kernelMajor;
int kernelMiddle;
int kernelMinor;
int kernelTiny;
ProcessField* fields;
ProcessField sortKey;
int direction;
@ -90,10 +97,30 @@ typedef struct ProcessList_ {
bool treeView;
bool highlightBaseName;
bool highlightMegabytes;
#ifdef DEBUG
FILE* traceFile;
#endif
} ProcessList;
#ifdef DEBUG
#define ProcessList_read(this, buffer, format, ...) ProcessList_xread(this, (vxscanf) vsscanf, buffer, format, ## __VA_ARGS__ )
#define ProcessList_fread(this, file, format, ...) ProcessList_xread(this, (vxscanf) vfscanf, file, format, ## __VA_ARGS__ )
#else
#ifndef ProcessList_read
#define ProcessList_fopen(this, path, mode) fopen(path, mode)
#define ProcessList_read(this, buffer, format, ...) sscanf(buffer, format, ## __VA_ARGS__ )
#define ProcessList_fread(this, file, format, ...) fscanf(file, format, ## __VA_ARGS__ )
#endif
#endif
ProcessList* ProcessList_new(UsersTable* usersTable);
@ -103,6 +130,7 @@ void ProcessList_invertSortOrder(ProcessList* this);
RichString ProcessList_printHeader(ProcessList* this);
void ProcessList_prune(ProcessList* this);
void ProcessList_add(ProcessList* this, Process* p);
@ -117,6 +145,10 @@ int ProcessList_size(ProcessList* this);
void ProcessList_sort(ProcessList* this);
bool ProcessList_readStatusFile(ProcessList* this, Process* proc, char* dirname, char* name);
void ProcessList_processEntries(ProcessList* this, char* dirname, int parent, float period);
void ProcessList_scan(ProcessList* this);
void ProcessList_dontCrash(int signal);