diff options
author | loderunner <loderunner@63cc0a6c-1f0e-0410-841e-f6a342073da8> | 2006-07-11 06:13:32 +0000 |
---|---|---|
committer | loderunner <loderunner@63cc0a6c-1f0e-0410-841e-f6a342073da8> | 2006-07-11 06:13:32 +0000 |
commit | b82a6490e6c54c80071eeff004b5283c63a31971 (patch) | |
tree | 13a209d132be00e28d24f9ce750a873055cfbd98 /Meter.c | |
parent | 6695cb64e57789798efbac1f6c5d0bb46a621e9b (diff) | |
download | htop-b82a6490e6c54c80071eeff004b5283c63a31971.tar.gz |
Performance improvement hackathon: improve process comparison routines,
disable useless code in release builds such as runtime type-checking on
dynamic data structures and process fields that are not being computed,
faster(?) method for verifying the process owner (still need to ensure
correctness), don't destroy and create process objects for hidden kernel
threads over and over. Phew. I shouldn't be doing all this today, but I
could not resist.
git-svn-id: svn://svn.code.sf.net/p/htop/code/trunk@44 63cc0a6c-1f0e-0410-841e-f6a342073da8
Diffstat (limited to 'Meter.c')
-rw-r--r-- | Meter.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -104,7 +104,11 @@ typedef enum { #define MAX(a,b) ((a)>(b)?(a):(b)) #endif +#ifdef DEBUG char* METER_CLASS = "Meter"; +#else +#define METER_CLASS NULL +#endif MeterType* Meter_types[] = { &CPUMeter, @@ -162,6 +166,9 @@ static RichString Meter_stringBuffer; Meter* Meter_new(ProcessList* pl, int param, MeterType* type) { Meter* this = calloc(sizeof(Meter), 1); + Object_setClass(this, METER_CLASS); + ((Object*)this)->delete = Meter_delete; + ((Object*)this)->display = type->display; this->h = 1; this->type = type; this->param = param; @@ -169,9 +176,6 @@ Meter* Meter_new(ProcessList* pl, int param, MeterType* type) { this->values = calloc(sizeof(double), type->items); this->total = type->total; this->caption = strdup(type->caption); - ((Object*)this)->delete = Meter_delete; - ((Object*)this)->class = METER_CLASS; - ((Object*)this)->display = type->display; Meter_setMode(this, type->mode); if (this->type->init) this->type->init(this); |