Using text_rss',
shlib_rss', data_rss' and
dirty_size' instead of
1998-08-12 Martin Baulig <martin@home-of-linux.org> * include/glibtop/procsegment.h (glibtop_proc_segment): Using `text_rss', `shlib_rss', `data_rss' and `dirty_size' instead of `tsr', `lrs', `drs' and `dt'. New field `stack_rss'. * sysdeps/linux/procmem.c: Memory sizes now correctly in bytes. * sysdeps/linux/procsegment.c: Dito. * sysdeps/kernel/procsegment.c: Stack pages are reported via `stack_rss' and no longer count towards `data_rss' * kernel/table.h (table_proc_segment): Added `srs' field. * kernel/table21/module.c (TBL_PROC_SEGMENT): Added kernel support for this. * sysdeps/{linux, kernel, stub}/procmap.c: New files.
This commit is contained in:
committed by
Martin Baulig
parent
da622f70c7
commit
9248d72018
17
ChangeLog
17
ChangeLog
@@ -1,3 +1,20 @@
|
|||||||
|
1998-08-12 Martin Baulig <martin@home-of-linux.org>
|
||||||
|
|
||||||
|
* include/glibtop/procsegment.h (glibtop_proc_segment): Using
|
||||||
|
`text_rss', `shlib_rss', `data_rss' and `dirty_size' instead of
|
||||||
|
`tsr', `lrs', `drs' and `dt'. New field `stack_rss'.
|
||||||
|
|
||||||
|
* sysdeps/linux/procmem.c: Memory sizes now correctly in bytes.
|
||||||
|
* sysdeps/linux/procsegment.c: Dito.
|
||||||
|
|
||||||
|
* sysdeps/kernel/procsegment.c: Stack pages are reported via
|
||||||
|
`stack_rss' and no longer count towards `data_rss'
|
||||||
|
* kernel/table.h (table_proc_segment): Added `srs' field.
|
||||||
|
* kernel/table21/module.c (TBL_PROC_SEGMENT): Added kernel support
|
||||||
|
for this.
|
||||||
|
|
||||||
|
* sysdeps/{linux, kernel, stub}/procmap.c: New files.
|
||||||
|
|
||||||
1998-08-11 Martin Baulig <martin@home-of-linux.org>
|
1998-08-11 Martin Baulig <martin@home-of-linux.org>
|
||||||
|
|
||||||
* guile/features.awk: New file.
|
* guile/features.awk: New file.
|
||||||
|
@@ -257,6 +257,21 @@ main (int argc, char *argv [])
|
|||||||
(unsigned long) data.proc_mem.rss,
|
(unsigned long) data.proc_mem.rss,
|
||||||
(unsigned long) data.proc_mem.rss_rlim);
|
(unsigned long) data.proc_mem.rss_rlim);
|
||||||
|
|
||||||
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
|
glibtop_get_proc_segment (&data.proc_segment, pid);
|
||||||
|
|
||||||
|
printf ("Proc_Segment PID %5u (0x%08lx): "
|
||||||
|
"%lu %lu %lu %lu %lu %lu %lu %lu\n", pid,
|
||||||
|
(unsigned long) data.proc_segment.flags,
|
||||||
|
(unsigned long) data.proc_segment.text_rss,
|
||||||
|
(unsigned long) data.proc_segment.shlib_rss,
|
||||||
|
(unsigned long) data.proc_segment.data_rss,
|
||||||
|
(unsigned long) data.proc_segment.stack_rss,
|
||||||
|
(unsigned long) data.proc_segment.dirty_size,
|
||||||
|
(unsigned long) data.proc_segment.start_code,
|
||||||
|
(unsigned long) data.proc_segment.end_code,
|
||||||
|
(unsigned long) data.proc_segment.start_stack);
|
||||||
|
|
||||||
getrusage (RUSAGE_SELF, &ru);
|
getrusage (RUSAGE_SELF, &ru);
|
||||||
|
|
||||||
fprintf (stderr, "GETRUSAGE: (%ld, %ld) - (%ld, %ld)\n",
|
fprintf (stderr, "GETRUSAGE: (%ld, %ld) - (%ld, %ld)\n",
|
||||||
@@ -306,20 +321,6 @@ main (int argc, char *argv [])
|
|||||||
(unsigned long) data.proc_kernel.nwchan,
|
(unsigned long) data.proc_kernel.nwchan,
|
||||||
data.proc_kernel.wchan);
|
data.proc_kernel.wchan);
|
||||||
|
|
||||||
for (c = 0; c < PROFILE_COUNT; c++)
|
|
||||||
glibtop_get_proc_segment (&data.proc_segment, pid);
|
|
||||||
|
|
||||||
printf ("Proc_Segment PID %5u (0x%08lx): "
|
|
||||||
"%lu %lu %lu %lu %lu %lu %lu\n", pid,
|
|
||||||
(unsigned long) data.proc_segment.flags,
|
|
||||||
(unsigned long) data.proc_segment.trs,
|
|
||||||
(unsigned long) data.proc_segment.lrs,
|
|
||||||
(unsigned long) data.proc_segment.drs,
|
|
||||||
(unsigned long) data.proc_segment.dt,
|
|
||||||
(unsigned long) data.proc_segment.start_code,
|
|
||||||
(unsigned long) data.proc_segment.end_code,
|
|
||||||
(unsigned long) data.proc_segment.start_stack);
|
|
||||||
|
|
||||||
printf ("\n");
|
printf ("\n");
|
||||||
|
|
||||||
for (c = 0; c < PROFILE_COUNT; c++)
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
@@ -356,6 +357,21 @@ main (int argc, char *argv [])
|
|||||||
(unsigned long) data.proc_mem.rss,
|
(unsigned long) data.proc_mem.rss,
|
||||||
(unsigned long) data.proc_mem.rss_rlim);
|
(unsigned long) data.proc_mem.rss_rlim);
|
||||||
|
|
||||||
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
|
glibtop_get_proc_segment (&data.proc_segment, ppid);
|
||||||
|
|
||||||
|
printf ("Proc_Segment PPID %5u (0x%08lx): "
|
||||||
|
"%lu %lu %lu %lu %lu %lu %lu %lu\n", ppid,
|
||||||
|
(unsigned long) data.proc_segment.flags,
|
||||||
|
(unsigned long) data.proc_segment.text_rss,
|
||||||
|
(unsigned long) data.proc_segment.shlib_rss,
|
||||||
|
(unsigned long) data.proc_segment.data_rss,
|
||||||
|
(unsigned long) data.proc_segment.stack_rss,
|
||||||
|
(unsigned long) data.proc_segment.dirty_size,
|
||||||
|
(unsigned long) data.proc_segment.start_code,
|
||||||
|
(unsigned long) data.proc_segment.end_code,
|
||||||
|
(unsigned long) data.proc_segment.start_stack);
|
||||||
|
|
||||||
for (c = 0; c < PROFILE_COUNT; c++)
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_proc_time (&data.proc_time, ppid);
|
glibtop_get_proc_time (&data.proc_time, ppid);
|
||||||
|
|
||||||
@@ -398,20 +414,6 @@ main (int argc, char *argv [])
|
|||||||
(unsigned long) data.proc_kernel.nwchan,
|
(unsigned long) data.proc_kernel.nwchan,
|
||||||
data.proc_kernel.wchan);
|
data.proc_kernel.wchan);
|
||||||
|
|
||||||
for (c = 0; c < PROFILE_COUNT; c++)
|
|
||||||
glibtop_get_proc_segment (&data.proc_segment, ppid);
|
|
||||||
|
|
||||||
printf ("Proc_Segment PPID %5u (0x%08lx): "
|
|
||||||
"%lu %lu %lu %lu %lu %lu %lu\n", ppid,
|
|
||||||
(unsigned long) data.proc_segment.flags,
|
|
||||||
(unsigned long) data.proc_segment.trs,
|
|
||||||
(unsigned long) data.proc_segment.lrs,
|
|
||||||
(unsigned long) data.proc_segment.drs,
|
|
||||||
(unsigned long) data.proc_segment.dt,
|
|
||||||
(unsigned long) data.proc_segment.start_code,
|
|
||||||
(unsigned long) data.proc_segment.end_code,
|
|
||||||
(unsigned long) data.proc_segment.start_stack);
|
|
||||||
|
|
||||||
printf ("\n");
|
printf ("\n");
|
||||||
|
|
||||||
for (c = 0; c < PROFILE_COUNT; c++)
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
@@ -448,6 +450,21 @@ main (int argc, char *argv [])
|
|||||||
(unsigned long) data.proc_mem.rss,
|
(unsigned long) data.proc_mem.rss,
|
||||||
(unsigned long) data.proc_mem.rss_rlim);
|
(unsigned long) data.proc_mem.rss_rlim);
|
||||||
|
|
||||||
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
|
glibtop_get_proc_segment (&data.proc_segment, 1);
|
||||||
|
|
||||||
|
printf ("Proc_Segment INIT %5u (0x%08lx): "
|
||||||
|
"%lu %lu %lu %lu %lu %lu %lu %lu\n", 1,
|
||||||
|
(unsigned long) data.proc_segment.flags,
|
||||||
|
(unsigned long) data.proc_segment.text_rss,
|
||||||
|
(unsigned long) data.proc_segment.shlib_rss,
|
||||||
|
(unsigned long) data.proc_segment.data_rss,
|
||||||
|
(unsigned long) data.proc_segment.stack_rss,
|
||||||
|
(unsigned long) data.proc_segment.dirty_size,
|
||||||
|
(unsigned long) data.proc_segment.start_code,
|
||||||
|
(unsigned long) data.proc_segment.end_code,
|
||||||
|
(unsigned long) data.proc_segment.start_stack);
|
||||||
|
|
||||||
for (c = 0; c < PROFILE_COUNT; c++)
|
for (c = 0; c < PROFILE_COUNT; c++)
|
||||||
glibtop_get_proc_time (&data.proc_time, 1);
|
glibtop_get_proc_time (&data.proc_time, 1);
|
||||||
|
|
||||||
@@ -491,20 +508,6 @@ main (int argc, char *argv [])
|
|||||||
(unsigned long) data.proc_kernel.nwchan,
|
(unsigned long) data.proc_kernel.nwchan,
|
||||||
data.proc_kernel.wchan);
|
data.proc_kernel.wchan);
|
||||||
|
|
||||||
for (c = 0; c < PROFILE_COUNT; c++)
|
|
||||||
glibtop_get_proc_segment (&data.proc_segment, 1);
|
|
||||||
|
|
||||||
printf ("Proc_Segment INIT %5u (0x%08lx): "
|
|
||||||
"%lu %lu %lu %lu %lu %lu %lu\n", 1,
|
|
||||||
(unsigned long) data.proc_segment.flags,
|
|
||||||
(unsigned long) data.proc_segment.trs,
|
|
||||||
(unsigned long) data.proc_segment.lrs,
|
|
||||||
(unsigned long) data.proc_segment.drs,
|
|
||||||
(unsigned long) data.proc_segment.dt,
|
|
||||||
(unsigned long) data.proc_segment.start_code,
|
|
||||||
(unsigned long) data.proc_segment.end_code,
|
|
||||||
(unsigned long) data.proc_segment.start_stack);
|
|
||||||
|
|
||||||
glibtop_close ();
|
glibtop_close ();
|
||||||
|
|
||||||
exit (0);
|
exit (0);
|
||||||
|
@@ -80,12 +80,11 @@ main (int argc, char *argv [])
|
|||||||
maps = glibtop_get_proc_map (&procmap, pid);
|
maps = glibtop_get_proc_map (&procmap, pid);
|
||||||
|
|
||||||
for (i = 0; i < procmap.number; i++) {
|
for (i = 0; i < procmap.number; i++) {
|
||||||
fprintf (stderr, "%08x - %08x - %08lu - %08lu - '%s'\n",
|
fprintf (stderr, "%08x - %08x - %08lu - %08lu\n",
|
||||||
(unsigned long) maps [i].start,
|
(unsigned long) maps [i].start,
|
||||||
(unsigned long) maps [i].end,
|
(unsigned long) maps [i].end,
|
||||||
(unsigned long) maps [i].device,
|
(unsigned long) maps [i].device,
|
||||||
(unsigned long) maps [i].inode,
|
(unsigned long) maps [i].inode);
|
||||||
devname (maps [i].device, S_IFBLK));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
glibtop_free (maps);
|
glibtop_free (maps);
|
||||||
|
@@ -115,6 +115,20 @@ main (int argc, char *argv [])
|
|||||||
(unsigned long) data.proc_mem.rss,
|
(unsigned long) data.proc_mem.rss,
|
||||||
(unsigned long) data.proc_mem.rss_rlim);
|
(unsigned long) data.proc_mem.rss_rlim);
|
||||||
|
|
||||||
|
glibtop_get_proc_segment (&data.proc_segment, pid);
|
||||||
|
|
||||||
|
printf ("Proc_Segment PID %5u (0x%08lx): "
|
||||||
|
"%lu %lu %lu %lu %lu %lu %lu %lu\n", pid,
|
||||||
|
(unsigned long) data.proc_segment.flags,
|
||||||
|
(unsigned long) data.proc_segment.text_rss,
|
||||||
|
(unsigned long) data.proc_segment.shlib_rss,
|
||||||
|
(unsigned long) data.proc_segment.data_rss,
|
||||||
|
(unsigned long) data.proc_segment.stack_rss,
|
||||||
|
(unsigned long) data.proc_segment.dirty_size,
|
||||||
|
(unsigned long) data.proc_segment.start_code,
|
||||||
|
(unsigned long) data.proc_segment.end_code,
|
||||||
|
(unsigned long) data.proc_segment.start_stack);
|
||||||
|
|
||||||
glibtop_get_proc_time (&data.proc_time, pid);
|
glibtop_get_proc_time (&data.proc_time, pid);
|
||||||
|
|
||||||
printf ("Proc_Time PID %5u (0x%08lx): "
|
printf ("Proc_Time PID %5u (0x%08lx): "
|
||||||
@@ -155,19 +169,6 @@ main (int argc, char *argv [])
|
|||||||
(unsigned long) data.proc_kernel.nwchan,
|
(unsigned long) data.proc_kernel.nwchan,
|
||||||
data.proc_kernel.wchan);
|
data.proc_kernel.wchan);
|
||||||
|
|
||||||
glibtop_get_proc_segment (&data.proc_segment, pid);
|
|
||||||
|
|
||||||
printf ("Proc_Segment PID %5u (0x%08lx): "
|
|
||||||
"%lu %lu %lu %lu %lu %lu %lu\n", pid,
|
|
||||||
(unsigned long) data.proc_segment.flags,
|
|
||||||
(unsigned long) data.proc_segment.trs,
|
|
||||||
(unsigned long) data.proc_segment.lrs,
|
|
||||||
(unsigned long) data.proc_segment.drs,
|
|
||||||
(unsigned long) data.proc_segment.dt,
|
|
||||||
(unsigned long) data.proc_segment.start_code,
|
|
||||||
(unsigned long) data.proc_segment.end_code,
|
|
||||||
(unsigned long) data.proc_segment.start_stack);
|
|
||||||
|
|
||||||
printf ("\n");
|
printf ("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -13,7 +13,7 @@ void|proc_mem|long(size,vsize,resident,share,rss,rss_rlim)|pid_t(pid)
|
|||||||
void|proc_time|long(start_time,rtime,utime,stime,cutime,cstime,timeout,it_real_value,frequency)|pid_t(pid)
|
void|proc_time|long(start_time,rtime,utime,stime,cutime,cstime,timeout,it_real_value,frequency)|pid_t(pid)
|
||||||
void|proc_signal|ulong(signal,blocked,sigignore,sigcatch)|pid_t(pid)
|
void|proc_signal|ulong(signal,blocked,sigignore,sigcatch)|pid_t(pid)
|
||||||
void|proc_kernel|ulong(k_flags,min_flt,maj_flt,cmin_flt,cmaj_flt,kstk_esp,kstk_eip,nwchan):str(wchan)|pid_t(pid)
|
void|proc_kernel|ulong(k_flags,min_flt,maj_flt,cmin_flt,cmaj_flt,kstk_esp,kstk_eip,nwchan):str(wchan)|pid_t(pid)
|
||||||
void|proc_segment|long(trs,lrs,drs,dt):ulong(start_code,end_code,start_stack)|pid_t(pid)
|
void|proc_segment|ulong(text_rss,shlib_rss,data_rss,stack_rss,dirty_size,start_code,end_code,start_stack)|pid_t(pid)
|
||||||
glibtop_map_entry *|proc_map|ulong(number,size,total)|pid_t(pid)
|
glibtop_map_entry *|proc_map|ulong(number,size,total)|pid_t(pid)
|
||||||
glibtop_mountentry *|@mountlist|ulong(number,size,total)|pid_t(all_fs)
|
glibtop_mountentry *|@mountlist|ulong(number,size,total)|pid_t(all_fs)
|
||||||
void|@fsusage|ulong(blocks,bfree,bavail,files,ffree)|string|mount_dir
|
void|@fsusage|ulong(blocks,bfree,bavail,files,ffree)|string|mount_dir
|
||||||
|
@@ -1457,13 +1457,14 @@ typedef struct _glibtop_proc_segment glibtop_proc_segment;
|
|||||||
struct _glibtop_proc_segment
|
struct _glibtop_proc_segment
|
||||||
{
|
{
|
||||||
u_int64_t flags;
|
u_int64_t flags;
|
||||||
u_int64_t start_code, /* GLIBTOP_PROC_SEGMENT_START_CODE */
|
u_int64_t text_rss, /* GLIBTOP_PROC_SEGMENT_TEXT_RSS */
|
||||||
|
shlib_rss, /* GLIBTOP_PROC_SEGMENT_SHLIB_RSS */
|
||||||
|
data_rss, /* GLIBTOP_PROC_SEGMENT_DATA_RSS */
|
||||||
|
stack_rss, /* GLIBTOP_PROC_SEGMENT_STACK_RSS */
|
||||||
|
dirty_size, /* GLIBTOP_PROC_SEGMENT_DIRTY_SIZE */
|
||||||
|
start_code, /* GLIBTOP_PROC_SEGMENT_START_CODE */
|
||||||
end_code, /* GLIBTOP_PROC_SEGMENT_END_CODE */
|
end_code, /* GLIBTOP_PROC_SEGMENT_END_CODE */
|
||||||
start_stack; /* GLIBTOP_PROC_SEGMENT_START_STACK */
|
start_stack; /* GLIBTOP_PROC_SEGMENT_START_STACK */
|
||||||
int64_t trs, /* GLIBTOP_PROC_SEGMENT_TRS */
|
|
||||||
lrs, /* GLIBTOP_PROC_SEGMENT_LRS */
|
|
||||||
drs, /* GLIBTOP_PROC_SEGMENT_DRS */
|
|
||||||
dt; /* GLIBTOP_PROC_SEGMENT_DT */
|
|
||||||
};
|
};
|
||||||
</literallayout>
|
</literallayout>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
@@ -1472,32 +1473,39 @@ struct _glibtop_proc_segment
|
|||||||
<variablelist>
|
<variablelist>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><parameter>trs</parameter></term>
|
<term><parameter>text_rss</parameter></term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
Text resident set size
|
Text resident set size
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><parameter>lrs</parameter></term>
|
<term><parameter>shlib_rss</parameter></term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
Shared-Lib resident set size
|
Shared-Lib resident set size
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><parameter>drs</parameter></term>
|
<term><parameter>data_rss</parameter></term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
Data resident set size
|
Data resident set size
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><parameter>dt</parameter></term>
|
<term><parameter>stack_rss</parameter></term>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
Dirty pages
|
Stack resident set size
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term><parameter>dirty_size</parameter></term>
|
||||||
|
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
Total size of dirty pages
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><parameter>start_code</parameter></term>
|
<term><parameter>start_code</parameter></term>
|
||||||
|
@@ -44,6 +44,10 @@ __BEGIN_DECLS
|
|||||||
#define GLIBTOP_KERN_PROC_UID 5
|
#define GLIBTOP_KERN_PROC_UID 5
|
||||||
#define GLIBTOP_KERN_PROC_RUID 6
|
#define GLIBTOP_KERN_PROC_RUID 6
|
||||||
|
|
||||||
|
#define GLIBTOP_EXCLUDE_IDLE 0x1000
|
||||||
|
#define GLIBTOP_EXCLUDE_SYSTEM 0x2000
|
||||||
|
#define GLIBTOP_EXCLUDE_NOTTY 0x4000
|
||||||
|
|
||||||
typedef struct _glibtop_proclist glibtop_proclist;
|
typedef struct _glibtop_proclist glibtop_proclist;
|
||||||
|
|
||||||
struct _glibtop_proclist
|
struct _glibtop_proclist
|
||||||
|
@@ -27,15 +27,16 @@
|
|||||||
|
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
|
|
||||||
#define GLIBTOP_PROC_SEGMENT_TRS 0
|
#define GLIBTOP_PROC_SEGMENT_TEXT_RSS 0
|
||||||
#define GLIBTOP_PROC_SEGMENT_LRS 1
|
#define GLIBTOP_PROC_SEGMENT_SHLIB_RSS 1
|
||||||
#define GLIBTOP_PROC_SEGMENT_DRS 2
|
#define GLIBTOP_PROC_SEGMENT_DATA_RSS 2
|
||||||
#define GLIBTOP_PROC_SEGMENT_DT 3
|
#define GLIBTOP_PROC_SEGMENT_STACK_RSS 3
|
||||||
#define GLIBTOP_PROC_SEGMENT_START_CODE 4
|
#define GLIBTOP_PROC_SEGMENT_DIRTY_SIZE 4
|
||||||
#define GLIBTOP_PROC_SEGMENT_END_CODE 5
|
#define GLIBTOP_PROC_SEGMENT_START_CODE 5
|
||||||
#define GLIBTOP_PROC_SEGMENT_START_STACK 6
|
#define GLIBTOP_PROC_SEGMENT_END_CODE 6
|
||||||
|
#define GLIBTOP_PROC_SEGMENT_START_STACK 7
|
||||||
|
|
||||||
#define GLIBTOP_MAX_PROC_SEGMENT 7
|
#define GLIBTOP_MAX_PROC_SEGMENT 8
|
||||||
|
|
||||||
typedef struct _glibtop_proc_segment glibtop_proc_segment;
|
typedef struct _glibtop_proc_segment glibtop_proc_segment;
|
||||||
|
|
||||||
@@ -44,10 +45,11 @@ typedef struct _glibtop_proc_segment glibtop_proc_segment;
|
|||||||
struct _glibtop_proc_segment
|
struct _glibtop_proc_segment
|
||||||
{
|
{
|
||||||
u_int64_t flags,
|
u_int64_t flags,
|
||||||
trs, /* text resident set size */
|
text_rss, /* text resident set size */
|
||||||
lrs, /* shared-lib resident set size */
|
shlib_rss, /* shared-lib resident set size */
|
||||||
drs, /* data resident set size */
|
data_rss, /* data resident set size */
|
||||||
dt, /* dirty pages */
|
stack_rss, /* stack resident set size */
|
||||||
|
dirty_size, /* size of dirty pages */
|
||||||
start_code,
|
start_code,
|
||||||
/* address of beginning of code segment */
|
/* address of beginning of code segment */
|
||||||
end_code, /* address of end of code segment */
|
end_code, /* address of end of code segment */
|
||||||
|
@@ -117,8 +117,8 @@ struct table_proc_mem
|
|||||||
struct table_proc_segment
|
struct table_proc_segment
|
||||||
{
|
{
|
||||||
unsigned long vsize;
|
unsigned long vsize;
|
||||||
int size, resident, shared;
|
unsigned long size, resident, shared;
|
||||||
int trs, lrs, drs, dt;
|
unsigned long trs, lrs, drs, srs, dt;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct table_proc_time
|
struct table_proc_time
|
||||||
|
@@ -473,7 +473,7 @@ table_fkt (int type, union table *buf, const void *param)
|
|||||||
if (tsk->mm && tsk->mm != &init_mm) {
|
if (tsk->mm && tsk->mm != &init_mm) {
|
||||||
unsigned long vsize = 0;
|
unsigned long vsize = 0;
|
||||||
int size = 0, resident = 0, share = 0;
|
int size = 0, resident = 0, share = 0;
|
||||||
int trs = 0, lrs = 0, drs = 0, dt = 0;
|
int trs = 0, lrs = 0, drs = 0, srs = 0, dt = 0;
|
||||||
struct vm_area_struct * vma = tsk->mm->mmap;
|
struct vm_area_struct * vma = tsk->mm->mmap;
|
||||||
|
|
||||||
while (vma) {
|
while (vma) {
|
||||||
@@ -486,27 +486,26 @@ table_fkt (int type, union table *buf, const void *param)
|
|||||||
|
|
||||||
&pages, &shared, &dirty, &total);
|
&pages, &shared, &dirty, &total);
|
||||||
|
|
||||||
#if 0
|
|
||||||
printk ("vma %p (%d) - %d, %d, %d, %d - "
|
|
||||||
"%lx - %lx, %lx - %lx - %lx\n",
|
|
||||||
vma, pid, pages, shared, dirty, total,
|
|
||||||
PAGE_SIZE, vma->vm_start, vma->vm_end,
|
|
||||||
vma->vm_end - vma->vm_start,
|
|
||||||
(vma->vm_end - vma->vm_start) >> PAGE_SHIFT);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
resident += pages;
|
resident += pages;
|
||||||
share += shared;
|
share += shared;
|
||||||
dt += dirty;
|
dt += dirty;
|
||||||
size += total;
|
size += total;
|
||||||
if (vma->vm_flags & VM_EXECUTABLE)
|
|
||||||
trs += pages; /* text */
|
/* Well, shared library seem to get mapped
|
||||||
else if (vma->vm_flags & VM_GROWSDOWN)
|
* above 0x40000000 and are executable,
|
||||||
drs += pages; /* stack */
|
* so I use this hack to get their size.
|
||||||
else if (vma->vm_end > 0x60000000)
|
*/
|
||||||
|
|
||||||
|
if (vma->vm_flags & VM_GROWSDOWN)
|
||||||
|
srs += pages; /* stack */
|
||||||
|
else if ((vma->vm_flags & VM_EXEC) &&
|
||||||
|
(vma->vm_start > 0x40000000))
|
||||||
lrs += pages; /* library */
|
lrs += pages; /* library */
|
||||||
|
else if (vma->vm_flags & VM_EXECUTABLE)
|
||||||
|
trs += pages; /* text */
|
||||||
else
|
else
|
||||||
drs += pages;
|
drs += pages;
|
||||||
|
|
||||||
vma = vma->vm_next;
|
vma = vma->vm_next;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -516,6 +515,8 @@ table_fkt (int type, union table *buf, const void *param)
|
|||||||
tbl.proc_segment.shared = share << PAGE_SHIFT;
|
tbl.proc_segment.shared = share << PAGE_SHIFT;
|
||||||
tbl.proc_segment.trs = trs << PAGE_SHIFT;
|
tbl.proc_segment.trs = trs << PAGE_SHIFT;
|
||||||
tbl.proc_segment.lrs = lrs << PAGE_SHIFT;
|
tbl.proc_segment.lrs = lrs << PAGE_SHIFT;
|
||||||
|
tbl.proc_segment.drs = drs << PAGE_SHIFT;
|
||||||
|
tbl.proc_segment.srs = srs << PAGE_SHIFT;
|
||||||
tbl.proc_segment.dt = dt << PAGE_SHIFT;
|
tbl.proc_segment.dt = dt << PAGE_SHIFT;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@@ -103,6 +103,8 @@ function output(feature) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
END {
|
END {
|
||||||
|
features["sysdeps"] = "sysdeps";
|
||||||
|
|
||||||
for (feature in features) {
|
for (feature in features) {
|
||||||
output(feature);
|
output(feature);
|
||||||
}
|
}
|
||||||
|
@@ -8,7 +8,7 @@ libgtop_sysdeps_la_SOURCES = open.c close.c kernel.s cpu.c mem.c swap.c \
|
|||||||
uptime.c loadavg.c shm_limits.c msg_limits.c \
|
uptime.c loadavg.c shm_limits.c msg_limits.c \
|
||||||
sem_limits.c proclist.c procstate.c procuid.c \
|
sem_limits.c proclist.c procstate.c procuid.c \
|
||||||
proctime.c procmem.c procsignal.c prockernel.c \
|
proctime.c procmem.c procsignal.c prockernel.c \
|
||||||
procsegment.c siglist.c
|
procsegment.c siglist.c procmap.c
|
||||||
|
|
||||||
include_HEADERS = glibtop_server.h
|
include_HEADERS = glibtop_server.h
|
||||||
|
|
||||||
|
@@ -40,6 +40,7 @@ __BEGIN_DECLS
|
|||||||
#define GLIBTOP_SUID_PROC_SIGNAL 0
|
#define GLIBTOP_SUID_PROC_SIGNAL 0
|
||||||
#define GLIBTOP_SUID_PROC_KERNEL 0
|
#define GLIBTOP_SUID_PROC_KERNEL 0
|
||||||
#define GLIBTOP_SUID_PROC_SEGMENT 0
|
#define GLIBTOP_SUID_PROC_SEGMENT 0
|
||||||
|
#define GLIBTOP_SUID_PROC_MAP 0
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
||||||
|
@@ -19,7 +19,7 @@ gcc2_compiled.:
|
|||||||
table:
|
table:
|
||||||
pushl %ebp
|
pushl %ebp
|
||||||
movl %esp,%ebp
|
movl %esp,%ebp
|
||||||
movl $188,%eax
|
movl $190,%eax
|
||||||
pushl %ebx
|
pushl %ebx
|
||||||
movl 8(%ebp),%ebx
|
movl 8(%ebp),%ebx
|
||||||
movl 12(%ebp),%ecx
|
movl 12(%ebp),%ecx
|
||||||
|
@@ -29,7 +29,7 @@ static const unsigned long _glibtop_sysdeps_proc_kernel =
|
|||||||
(1 << GLIBTOP_PROC_KERNEL_K_FLAGS) + (1 << GLIBTOP_PROC_KERNEL_MIN_FLT) +
|
(1 << GLIBTOP_PROC_KERNEL_K_FLAGS) + (1 << GLIBTOP_PROC_KERNEL_MIN_FLT) +
|
||||||
(1 << GLIBTOP_PROC_KERNEL_MAJ_FLT) + (1 << GLIBTOP_PROC_KERNEL_CMIN_FLT) +
|
(1 << GLIBTOP_PROC_KERNEL_MAJ_FLT) + (1 << GLIBTOP_PROC_KERNEL_CMIN_FLT) +
|
||||||
(1 << GLIBTOP_PROC_KERNEL_CMAJ_FLT) + (1 << GLIBTOP_PROC_KERNEL_KSTK_ESP) +
|
(1 << GLIBTOP_PROC_KERNEL_CMAJ_FLT) + (1 << GLIBTOP_PROC_KERNEL_KSTK_ESP) +
|
||||||
(1 << GLIBTOP_PROC_KERNEL_KSTK_EIP) + (1 << GLIBTOP_PROC_KERNEL_WCHAN);
|
(1 << GLIBTOP_PROC_KERNEL_KSTK_EIP) + (1 << GLIBTOP_PROC_KERNEL_NWCHAN);
|
||||||
|
|
||||||
/* Init function. */
|
/* Init function. */
|
||||||
|
|
||||||
@@ -62,5 +62,5 @@ glibtop_get_proc_kernel_s (glibtop *server, glibtop_proc_kernel *buf,
|
|||||||
buf->cmaj_flt = tbl.proc_kernel.cmaj_flt;
|
buf->cmaj_flt = tbl.proc_kernel.cmaj_flt;
|
||||||
buf->kstk_esp = tbl.proc_kernel.kesp;
|
buf->kstk_esp = tbl.proc_kernel.kesp;
|
||||||
buf->kstk_eip = tbl.proc_kernel.keip;
|
buf->kstk_eip = tbl.proc_kernel.keip;
|
||||||
buf->wchan = tbl.proc_kernel.wchan;
|
buf->nwchan = tbl.proc_kernel.wchan;
|
||||||
}
|
}
|
||||||
|
@@ -54,7 +54,8 @@ glibtop_init_proclist_s (glibtop *server)
|
|||||||
* On error, NULL is returned and buf->flags is zero. */
|
* On error, NULL is returned and buf->flags is zero. */
|
||||||
|
|
||||||
unsigned *
|
unsigned *
|
||||||
glibtop_get_proclist_s (glibtop *server, glibtop_proclist *buf)
|
glibtop_get_proclist_s (glibtop *server, glibtop_proclist *buf,
|
||||||
|
int64_t which, int64_t arg)
|
||||||
{
|
{
|
||||||
union table tbl;
|
union table tbl;
|
||||||
unsigned *pids_chain;
|
unsigned *pids_chain;
|
||||||
|
47
sysdeps/kernel/procmap.c
Normal file
47
sysdeps/kernel/procmap.c
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
/* $Id$ */
|
||||||
|
|
||||||
|
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||||
|
This file is part of the Gnome Top Library.
|
||||||
|
Contributed by Joshua Sled <jsled@xcf.berkeley.edu>, July 1998.
|
||||||
|
|
||||||
|
The Gnome Top Library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The Gnome Top Library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
#include <glibtop.h>
|
||||||
|
#include <glibtop/error.h>
|
||||||
|
#include <glibtop/xmalloc.h>
|
||||||
|
#include <glibtop/procmap.h>
|
||||||
|
|
||||||
|
static const unsigned long _glibtop_sysdeps_proc_map = 0;
|
||||||
|
|
||||||
|
/* Init function. */
|
||||||
|
|
||||||
|
void
|
||||||
|
glibtop_init_proc_map_s (glibtop *server)
|
||||||
|
{
|
||||||
|
server->sysdeps.proc_map = _glibtop_sysdeps_proc_map;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Provides detailed information about a process. */
|
||||||
|
|
||||||
|
glibtop_map_entry *
|
||||||
|
glibtop_get_proc_map_s (glibtop *server, glibtop_proc_map *buf, pid_t pid)
|
||||||
|
{
|
||||||
|
glibtop_init_s (&server, GLIBTOP_SYSDEPS_PROC_MAP, 0);
|
||||||
|
|
||||||
|
memset (buf, 0, sizeof (glibtop_proc_map));
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
@@ -26,9 +26,13 @@
|
|||||||
#include "kernel.h"
|
#include "kernel.h"
|
||||||
|
|
||||||
static const unsigned long _glibtop_sysdeps_proc_segment =
|
static const unsigned long _glibtop_sysdeps_proc_segment =
|
||||||
(1 << GLIBTOP_PROC_SEGMENT_TRS) + (1 << GLIBTOP_PROC_SEGMENT_LRS) +
|
(1 << GLIBTOP_PROC_SEGMENT_TEXT_RSS) +
|
||||||
(1 << GLIBTOP_PROC_SEGMENT_DRS) + (1 << GLIBTOP_PROC_SEGMENT_DT) +
|
(1 << GLIBTOP_PROC_SEGMENT_SHLIB_RSS) +
|
||||||
(1 << GLIBTOP_PROC_SEGMENT_START_CODE) + (1 << GLIBTOP_PROC_SEGMENT_END_CODE) +
|
(1 << GLIBTOP_PROC_SEGMENT_DATA_RSS) +
|
||||||
|
(1 << GLIBTOP_PROC_SEGMENT_STACK_RSS) +
|
||||||
|
(1 << GLIBTOP_PROC_SEGMENT_DIRTY_SIZE) +
|
||||||
|
(1 << GLIBTOP_PROC_SEGMENT_START_CODE) +
|
||||||
|
(1 << GLIBTOP_PROC_SEGMENT_END_CODE) +
|
||||||
(1 << GLIBTOP_PROC_SEGMENT_START_STACK);
|
(1 << GLIBTOP_PROC_SEGMENT_START_STACK);
|
||||||
|
|
||||||
/* Init function. */
|
/* Init function. */
|
||||||
@@ -63,8 +67,9 @@ glibtop_get_proc_segment_s (glibtop *server, glibtop_proc_segment *buf,
|
|||||||
|
|
||||||
buf->flags = _glibtop_sysdeps_proc_segment;
|
buf->flags = _glibtop_sysdeps_proc_segment;
|
||||||
|
|
||||||
buf->trs = tbl.proc_segment.trs;
|
buf->text_rss = tbl.proc_segment.trs;
|
||||||
buf->lrs = tbl.proc_segment.lrs;
|
buf->shlib_rss = tbl.proc_segment.lrs;
|
||||||
buf->drs = tbl.proc_segment.drs;
|
buf->data_rss = tbl.proc_segment.drs;
|
||||||
buf->dt = tbl.proc_segment.dt;
|
buf->stack_rss = tbl.proc_segment.srs;
|
||||||
|
buf->dirty_size = tbl.proc_segment.dt;
|
||||||
}
|
}
|
||||||
|
@@ -8,6 +8,6 @@ libgtop_sysdeps_la_SOURCES = open.c close.c cpu.c mem.c swap.c \
|
|||||||
uptime.c loadavg.c shm_limits.c msg_limits.c \
|
uptime.c loadavg.c shm_limits.c msg_limits.c \
|
||||||
sem_limits.c proclist.c procstate.c procuid.c \
|
sem_limits.c proclist.c procstate.c procuid.c \
|
||||||
proctime.c procmem.c procsignal.c prockernel.c \
|
proctime.c procmem.c procsignal.c prockernel.c \
|
||||||
procsegment.c siglist.c
|
procsegment.c procmap.c siglist.c
|
||||||
|
|
||||||
include_HEADERS = glibtop_server.h glibtop_machine.h
|
include_HEADERS = glibtop_server.h glibtop_machine.h
|
||||||
|
@@ -40,6 +40,7 @@ __BEGIN_DECLS
|
|||||||
#define GLIBTOP_SUID_PROC_SIGNAL 0
|
#define GLIBTOP_SUID_PROC_SIGNAL 0
|
||||||
#define GLIBTOP_SUID_PROC_KERNEL 0
|
#define GLIBTOP_SUID_PROC_KERNEL 0
|
||||||
#define GLIBTOP_SUID_PROC_SEGMENT 0
|
#define GLIBTOP_SUID_PROC_SEGMENT 0
|
||||||
|
#define GLIBTOP_SUID_PROC_MAP 0
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
||||||
|
@@ -57,7 +57,8 @@ glibtop_init_proclist_s (glibtop *server)
|
|||||||
* On error, NULL is returned and buf->flags is zero. */
|
* On error, NULL is returned and buf->flags is zero. */
|
||||||
|
|
||||||
unsigned *
|
unsigned *
|
||||||
glibtop_get_proclist_s (glibtop *server, glibtop_proclist *buf)
|
glibtop_get_proclist_s (glibtop *server, glibtop_proclist *buf,
|
||||||
|
int64_t which, int64_t arg)
|
||||||
{
|
{
|
||||||
DIR *proc;
|
DIR *proc;
|
||||||
struct dirent *entry;
|
struct dirent *entry;
|
||||||
|
47
sysdeps/linux/procmap.c
Normal file
47
sysdeps/linux/procmap.c
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
/* $Id$ */
|
||||||
|
|
||||||
|
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||||
|
This file is part of the Gnome Top Library.
|
||||||
|
Contributed by Joshua Sled <jsled@xcf.berkeley.edu>, July 1998.
|
||||||
|
|
||||||
|
The Gnome Top Library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The Gnome Top Library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
#include <glibtop.h>
|
||||||
|
#include <glibtop/error.h>
|
||||||
|
#include <glibtop/xmalloc.h>
|
||||||
|
#include <glibtop/procmap.h>
|
||||||
|
|
||||||
|
static const unsigned long _glibtop_sysdeps_proc_map = 0;
|
||||||
|
|
||||||
|
/* Init function. */
|
||||||
|
|
||||||
|
void
|
||||||
|
glibtop_init_proc_map_s (glibtop *server)
|
||||||
|
{
|
||||||
|
server->sysdeps.proc_map = _glibtop_sysdeps_proc_map;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Provides detailed information about a process. */
|
||||||
|
|
||||||
|
glibtop_map_entry *
|
||||||
|
glibtop_get_proc_map_s (glibtop *server, glibtop_proc_map *buf, pid_t pid)
|
||||||
|
{
|
||||||
|
glibtop_init_s (&server, GLIBTOP_SYSDEPS_PROC_MAP, 0);
|
||||||
|
|
||||||
|
memset (buf, 0, sizeof (glibtop_proc_map));
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
@@ -28,12 +28,33 @@ static const unsigned long _glibtop_sysdeps_proc_mem =
|
|||||||
(1 << GLIBTOP_PROC_MEM_RESIDENT) + (1 << GLIBTOP_PROC_MEM_SHARE) +
|
(1 << GLIBTOP_PROC_MEM_RESIDENT) + (1 << GLIBTOP_PROC_MEM_SHARE) +
|
||||||
(1 << GLIBTOP_PROC_MEM_RSS) + (1 << GLIBTOP_PROC_MEM_RSS_RLIM);
|
(1 << GLIBTOP_PROC_MEM_RSS) + (1 << GLIBTOP_PROC_MEM_RSS_RLIM);
|
||||||
|
|
||||||
|
#ifndef LOG1024
|
||||||
|
#define LOG1024 10
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* these are for getting the memory statistics */
|
||||||
|
static int pageshift; /* log base 2 of the pagesize */
|
||||||
|
|
||||||
|
/* define pagetok in terms of pageshift */
|
||||||
|
#define pagetok(size) ((size) << pageshift)
|
||||||
|
|
||||||
/* Init function. */
|
/* Init function. */
|
||||||
|
|
||||||
void
|
void
|
||||||
glibtop_init_proc_mem_s (glibtop *server)
|
glibtop_init_proc_mem_s (glibtop *server)
|
||||||
{
|
{
|
||||||
|
register int pagesize;
|
||||||
|
|
||||||
server->sysdeps.proc_mem = _glibtop_sysdeps_proc_mem;
|
server->sysdeps.proc_mem = _glibtop_sysdeps_proc_mem;
|
||||||
|
|
||||||
|
/* get the page size with "getpagesize" and calculate pageshift
|
||||||
|
* from it */
|
||||||
|
pagesize = getpagesize ();
|
||||||
|
pageshift = 0;
|
||||||
|
while (pagesize > 1) {
|
||||||
|
pageshift++;
|
||||||
|
pagesize >>= 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Provides detailed information about a process. */
|
/* Provides detailed information about a process. */
|
||||||
@@ -93,6 +114,11 @@ glibtop_get_proc_mem_s (glibtop *server, glibtop_proc_mem *buf, pid_t pid)
|
|||||||
sscanf (input, "%Lu %Lu %Lu",
|
sscanf (input, "%Lu %Lu %Lu",
|
||||||
&buf->size, &buf->resident, &buf->share);
|
&buf->size, &buf->resident, &buf->share);
|
||||||
|
|
||||||
|
buf->size <<= pageshift;
|
||||||
|
buf->resident <<= pageshift;
|
||||||
|
buf->share <<= pageshift;
|
||||||
|
buf->rss <<= pageshift;
|
||||||
|
|
||||||
fclose (f);
|
fclose (f);
|
||||||
|
|
||||||
buf->flags = _glibtop_sysdeps_proc_mem;
|
buf->flags = _glibtop_sysdeps_proc_mem;
|
||||||
|
@@ -24,17 +24,41 @@
|
|||||||
#include <glibtop/procsegment.h>
|
#include <glibtop/procsegment.h>
|
||||||
|
|
||||||
static const unsigned long _glibtop_sysdeps_proc_segment =
|
static const unsigned long _glibtop_sysdeps_proc_segment =
|
||||||
(1 << GLIBTOP_PROC_SEGMENT_TRS) + (1 << GLIBTOP_PROC_SEGMENT_LRS) +
|
(1 << GLIBTOP_PROC_SEGMENT_TEXT_RSS) +
|
||||||
(1 << GLIBTOP_PROC_SEGMENT_DRS) + (1 << GLIBTOP_PROC_SEGMENT_DT) +
|
(1 << GLIBTOP_PROC_SEGMENT_SHLIB_RSS) +
|
||||||
(1 << GLIBTOP_PROC_SEGMENT_START_CODE) + (1 << GLIBTOP_PROC_SEGMENT_END_CODE) +
|
(1 << GLIBTOP_PROC_SEGMENT_DATA_RSS) +
|
||||||
|
(1 << GLIBTOP_PROC_SEGMENT_DIRTY_SIZE) +
|
||||||
|
(1 << GLIBTOP_PROC_SEGMENT_START_CODE) +
|
||||||
|
(1 << GLIBTOP_PROC_SEGMENT_END_CODE) +
|
||||||
(1 << GLIBTOP_PROC_SEGMENT_START_STACK);
|
(1 << GLIBTOP_PROC_SEGMENT_START_STACK);
|
||||||
|
|
||||||
|
#ifndef LOG1024
|
||||||
|
#define LOG1024 10
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* these are for getting the memory statistics */
|
||||||
|
static int pageshift; /* log base 2 of the pagesize */
|
||||||
|
|
||||||
|
/* define pagetok in terms of pageshift */
|
||||||
|
#define pagetok(size) ((size) << pageshift)
|
||||||
|
|
||||||
/* Init function. */
|
/* Init function. */
|
||||||
|
|
||||||
void
|
void
|
||||||
glibtop_init_proc_segment_s (glibtop *server)
|
glibtop_init_proc_segment_s (glibtop *server)
|
||||||
{
|
{
|
||||||
|
register int pagesize;
|
||||||
|
|
||||||
server->sysdeps.proc_segment = _glibtop_sysdeps_proc_segment;
|
server->sysdeps.proc_segment = _glibtop_sysdeps_proc_segment;
|
||||||
|
|
||||||
|
/* get the page size with "getpagesize" and calculate pageshift
|
||||||
|
* from it */
|
||||||
|
pagesize = getpagesize ();
|
||||||
|
pageshift = 0;
|
||||||
|
while (pagesize > 1) {
|
||||||
|
pageshift++;
|
||||||
|
pagesize >>= 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Provides detailed information about a process. */
|
/* Provides detailed information about a process. */
|
||||||
@@ -94,7 +118,13 @@ glibtop_get_proc_segment_s (glibtop *server, glibtop_proc_segment *buf,
|
|||||||
input [nread] = 0;
|
input [nread] = 0;
|
||||||
|
|
||||||
sscanf (input, "%*d %*d %*d %Lu %Lu %Lu %Lu",
|
sscanf (input, "%*d %*d %*d %Lu %Lu %Lu %Lu",
|
||||||
&buf->trs, &buf->lrs, &buf->drs, &buf->dt);
|
&buf->text_rss, &buf->shlib_rss,
|
||||||
|
&buf->data_rss, &buf->dirty_size);
|
||||||
|
|
||||||
|
buf->text_rss <<= pageshift;
|
||||||
|
buf->shlib_rss <<= pageshift;
|
||||||
|
buf->data_rss <<= pageshift;
|
||||||
|
buf->dirty_size <<= pageshift;
|
||||||
|
|
||||||
fclose (f);
|
fclose (f);
|
||||||
|
|
||||||
|
@@ -24,20 +24,21 @@
|
|||||||
|
|
||||||
const char *glibtop_names_proc_segment [GLIBTOP_MAX_PROC_SEGMENT] =
|
const char *glibtop_names_proc_segment [GLIBTOP_MAX_PROC_SEGMENT] =
|
||||||
{
|
{
|
||||||
"trs", "lrs", "drs", "dt", "start_code", "end_code", "start_stack"
|
"text_rss", "shlib_rss", "data_rss", "stack_rss",
|
||||||
|
"dirty_size", "start_code", "end_code", "start_stack"
|
||||||
};
|
};
|
||||||
|
|
||||||
const unsigned glibtop_types_proc_segment [GLIBTOP_MAX_PROC_SEGMENT] =
|
const unsigned glibtop_types_proc_segment [GLIBTOP_MAX_PROC_SEGMENT] =
|
||||||
{
|
{
|
||||||
GLIBTOP_TYPE_LONG, GLIBTOP_TYPE_LONG, GLIBTOP_TYPE_LONG,
|
GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG,
|
||||||
GLIBTOP_TYPE_LONG, GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG,
|
GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG,
|
||||||
GLIBTOP_TYPE_ULONG
|
GLIBTOP_TYPE_ULONG, GLIBTOP_TYPE_ULONG
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *glibtop_labels_proc_segment [GLIBTOP_MAX_PROC_SEGMENT] =
|
const char *glibtop_labels_proc_segment [GLIBTOP_MAX_PROC_SEGMENT] =
|
||||||
{
|
{
|
||||||
N_("TRS"), N_("LRS"), N_("DRS"), N_("DT"), N_("Start_Code"),
|
N_("Text_RSS"), N_("ShLib_RSS"), N_("Data_RSS"), N_("Stack_RSS"),
|
||||||
N_("End_Code"), N_("Start_Stack")
|
N_("Dirty Size"), N_("Start_Code"), N_("End_Code"), N_("Start_Stack")
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *glibtop_descriptions_proc_segment [GLIBTOP_MAX_PROC_SEGMENT] =
|
const char *glibtop_descriptions_proc_segment [GLIBTOP_MAX_PROC_SEGMENT] =
|
||||||
@@ -45,7 +46,8 @@ const char *glibtop_descriptions_proc_segment [GLIBTOP_MAX_PROC_SEGMENT] =
|
|||||||
N_("Text resident set size"),
|
N_("Text resident set size"),
|
||||||
N_("Shared-Lib resident set size"),
|
N_("Shared-Lib resident set size"),
|
||||||
N_("Data resident set size"),
|
N_("Data resident set size"),
|
||||||
N_("Dirty pages"),
|
N_("Stack resident set size"),
|
||||||
|
N_("Total size of dirty pages"),
|
||||||
N_("Address of beginning of code segment"),
|
N_("Address of beginning of code segment"),
|
||||||
N_("Address of end of code segment"),
|
N_("Address of end of code segment"),
|
||||||
N_("Address of the bottom of stack segment")
|
N_("Address of the bottom of stack segment")
|
||||||
|
@@ -8,5 +8,5 @@ libgtop_sysdeps_la_SOURCES = open.c close.c siglist.c cpu.c mem.c swap.c \
|
|||||||
uptime.c loadavg.c shm_limits.c msg_limits.c \
|
uptime.c loadavg.c shm_limits.c msg_limits.c \
|
||||||
sem_limits.c proclist.c procstate.c procuid.c \
|
sem_limits.c proclist.c procstate.c procuid.c \
|
||||||
proctime.c procmem.c procsignal.c prockernel.c \
|
proctime.c procmem.c procsignal.c prockernel.c \
|
||||||
procsegment.c
|
procsegment.c procmap.c
|
||||||
|
|
||||||
|
47
sysdeps/stub/procmap.c
Normal file
47
sysdeps/stub/procmap.c
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
/* $Id$ */
|
||||||
|
|
||||||
|
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||||
|
This file is part of the Gnome Top Library.
|
||||||
|
Contributed by Joshua Sled <jsled@xcf.berkeley.edu>, July 1998.
|
||||||
|
|
||||||
|
The Gnome Top Library is free software; you can redistribute it and/or
|
||||||
|
modify it under the terms of the GNU Library General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2 of the
|
||||||
|
License, or (at your option) any later version.
|
||||||
|
|
||||||
|
The Gnome Top Library is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Library General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Library General Public
|
||||||
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||||
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||||
|
Boston, MA 02111-1307, USA. */
|
||||||
|
|
||||||
|
#include <glibtop.h>
|
||||||
|
#include <glibtop/error.h>
|
||||||
|
#include <glibtop/xmalloc.h>
|
||||||
|
#include <glibtop/procmap.h>
|
||||||
|
|
||||||
|
static const unsigned long _glibtop_sysdeps_proc_map = 0;
|
||||||
|
|
||||||
|
/* Init function. */
|
||||||
|
|
||||||
|
void
|
||||||
|
glibtop_init_proc_map_s (glibtop *server)
|
||||||
|
{
|
||||||
|
server->sysdeps.proc_map = _glibtop_sysdeps_proc_map;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Provides detailed information about a process. */
|
||||||
|
|
||||||
|
glibtop_map_entry *
|
||||||
|
glibtop_get_proc_map_s (glibtop *server, glibtop_proc_map *buf, pid_t pid)
|
||||||
|
{
|
||||||
|
glibtop_init_s (&server, GLIBTOP_SYSDEPS_PROC_MAP, 0);
|
||||||
|
|
||||||
|
memset (buf, 0, sizeof (glibtop_proc_map));
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
Reference in New Issue
Block a user