diff --git a/proc/readproc.c b/proc/readproc.c index b96d0a4..f71c514 100644 --- a/proc/readproc.c +++ b/proc/readproc.c @@ -176,6 +176,7 @@ ENTER(0x220); P->vm_stack= 0; P->vm_exe = 0; P->vm_lib = 0; + P->vm_swap = 0; P->nlwp = 0; P->signal[0] = '\0'; // so we can detect it as missing for very old kernels diff --git a/top.c b/top.c index 6d4a7cc..93db9f0 100644 --- a/top.c +++ b/top.c @@ -215,7 +215,7 @@ static int sort_P_TME (const proc_t **P, const proc_t **Q) } SCB_NUM1(P_VRT, size) -SCB_NUM2(P_SWP, size, resident) +SCB_NUM1(P_SWP, vm_swap) SCB_NUM1(P_RES, resident) // also serves P_MEM ! SCB_NUM1(P_COD, trs) SCB_NUM1(P_DAT, drs) @@ -1243,7 +1243,7 @@ static FLD_t Fieldstab[] = { { "MmRr", " TIME+ ", " %9.9s", 9, -1, SF(TME), "CPU Time, hundredths", L_stat }, { "NnFf", " %MEM", " %#4.1f", -1, -1, SF(RES), "Memory usage (RES)", L_statm }, { "OoMm", " VIRT", " %5.5s", 5, SK_Kb, SF(VRT), "Virtual Image (kb)", L_statm }, - { "PpOo", " SWAP", " %4.4s", 4, SK_Kb, SF(SWP), "Swapped size (kb)", L_statm }, + { "PpOo", " SWAP", " %4.4s", 4, SK_Kb, SF(SWP), "Swapped size (kb)", L_status }, { "QqTt", " RES", " %4.4s", 4, SK_Kb, SF(RES), "Resident size (kb)", L_statm }, { "RrKk", " CODE", " %4.4s", 4, SK_Kb, SF(COD), "Code size (kb)", L_statm }, { "SsLl", " DATA", " %4.4s", 4, SK_Kb, SF(DAT), "Data+Stack size (kb)", L_statm }, @@ -3134,7 +3134,7 @@ static void task_show (const WIN_t *q, const proc_t *p) MKCOL(p->state); break; case P_SWP: - MKCOL(scale_num(PAGES_TO_KB(p->size - p->resident), w, s)); + MKCOL(scale_num(p->vm_swap, w, s)); break; case P_TME: case P_TM2: diff -up ./top.1.man ./top.1 --- ./top.1.man 2011-06-01 11:53:16.000000000 +0200 +++ ./top.1 2011-06-02 12:54:00.832202591 +0200 @@ -407,9 +407,7 @@ will be calculated from the /proc/#/stat .TP 3 p:\fB SWAP\fR \*(EM Swapped size (kb) -Memory that is not resident but is present in a task. This is memory that -has been swapped out but could include additional non-resident memory. -This column is calculated by subtracting \*(MP from \*(MV. +The non-resident portion of a task's address space. .TP 3 q:\fB RES\fR \*(EM Resident size (kb)