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
|
Fix page size on BSD systems.
Index: htop/Process.c
===================================================================
--- htop.orig/Process.c 2009-03-29 22:51:01.865040249 +0300
+++ htop/Process.c 2009-03-29 22:51:02.933034296 +0300
@@ -33,8 +33,9 @@
// This works only with glibc 2.1+. On earlier versions
// the behavior is similar to have a hardcoded page size.
#ifndef PAGE_SIZE
-#define PAGE_SIZE ( sysconf(_SC_PAGESIZE) / 1024 )
+#define PAGE_SIZE ( sysconf(_SC_PAGESIZE) )
#endif
+#define PAGE_SIZE_KB ( PAGE_SIZE / ONE_K )
#define PROCESS_COMM_LEN 300
@@ -351,13 +352,13 @@
: attr;
break;
}
- case M_DRS: Process_printLargeNumber(this, str, this->m_drs * PAGE_SIZE); return;
- case M_DT: Process_printLargeNumber(this, str, this->m_dt * PAGE_SIZE); return;
- case M_LRS: Process_printLargeNumber(this, str, this->m_lrs * PAGE_SIZE); return;
- case M_TRS: Process_printLargeNumber(this, str, this->m_trs * PAGE_SIZE); return;
- case M_SIZE: Process_printLargeNumber(this, str, this->m_size * PAGE_SIZE); return;
- case M_RESIDENT: Process_printLargeNumber(this, str, this->m_resident * PAGE_SIZE); return;
- case M_SHARE: Process_printLargeNumber(this, str, this->m_share * PAGE_SIZE); return;
+ case M_DRS: Process_printLargeNumber(this, str, this->m_drs * PAGE_SIZE_KB); return;
+ case M_DT: Process_printLargeNumber(this, str, this->m_dt * PAGE_SIZE_KB); return;
+ case M_LRS: Process_printLargeNumber(this, str, this->m_lrs * PAGE_SIZE_KB); return;
+ case M_TRS: Process_printLargeNumber(this, str, this->m_trs * PAGE_SIZE_KB); return;
+ case M_SIZE: Process_printLargeNumber(this, str, this->m_size * PAGE_SIZE_KB); return;
+ case M_RESIDENT: Process_printLargeNumber(this, str, this->m_resident * PAGE_SIZE_KB); return;
+ case M_SHARE: Process_printLargeNumber(this, str, this->m_share * PAGE_SIZE_KB); return;
case ST_UID: snprintf(buffer, n, "%4d ", this->st_uid); break;
case USER: {
if (Process_getuid != this->st_uid)
Index: htop/ProcessList.c
===================================================================
--- htop.orig/ProcessList.c 2009-03-29 22:48:20.445032821 +0300
+++ htop/ProcessList.c 2009-03-29 22:51:02.933034296 +0300
@@ -698,7 +698,7 @@
period * 100.0;
process->percent_cpu = MAX(MIN(percent_cpu, processors*100.0), 0.0);
- process->percent_mem = (process->m_resident * PAGE_SIZE) /
+ process->percent_mem = (process->m_resident * PAGE_SIZE_KB) /
(float)(this->totalMem) *
100.0;
|