summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Harris <pharris@opentext.com>2019-10-07 14:14:55 -0400
committerBenjamin Tissoires <benjamin.tissoires@redhat.com>2021-07-28 17:08:58 +0200
commite7887edff307fc4fb05aa7a7a0f6f96df171e431 (patch)
treeb6f6864ca5b903defd0e50e566887a3c747dfd28
parent19f72d344367a2bd250b5700f412625b249a90fd (diff)
Display ShmSeg resource count
Shared Memory Segments are often a globally constrained resource. For example, Red Hat defaults to a limit of 4096 total system-wide.
-rw-r--r--xrestop.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/xrestop.c b/xrestop.c
index c8577d4..cb28d99 100644
--- a/xrestop.c
+++ b/xrestop.c
@@ -60,6 +60,7 @@ enum {
ATOM_COLORMAP_ENTRY,
ATOM_PASSIVE_GRAB,
ATOM_CURSOR,
+ ATOM_SHMSEG,
ATOM_NET_CLIENT_LIST,
ATOM_NET_WM_PID,
ATOM_NET_WM_NAME,
@@ -78,6 +79,7 @@ static const char *AtomNames[] =
"COLORMAP ENTRY",
"PASSIVE GRAB",
"CURSOR",
+ "ShmSeg",
"_NET_CLIENT_LIST",
"_NET_WM_PID",
"_NET_WM_NAME",
@@ -102,6 +104,7 @@ typedef struct XResTopClient
int n_colormaps;
int n_passive_grabs;
int n_cursors;
+ int n_shmsegs;
int n_other;
} XResTopClient;
@@ -437,6 +440,8 @@ xrestop_client_get_stats(XResTopApp *app, XResTopClient *client)
client->n_passive_grabs += types[j].count;
else if (this_type == app->atoms[ATOM_CURSOR])
client->n_cursors += types[j].count;
+ else if (this_type == app->atoms[ATOM_SHMSEG])
+ client->n_shmsegs += types[j].count;
else client->n_other += types[j].count;
}
@@ -458,6 +463,7 @@ xrestop_client_get_stats(XResTopApp *app, XResTopClient *client)
client->other_bytes += client->n_colormaps * 24;
client->other_bytes += client->n_passive_grabs * 24;
client->other_bytes += client->n_cursors * 24;
+ client->other_bytes += client->n_shmsegs * 24;
client->other_bytes += client->n_other * 24;
cleanup:
@@ -545,7 +551,7 @@ xrestop_display(XResTopApp *app)
attron(A_BOLD|A_REVERSE);
- mvprintw(4, 0, "res-base Wins GCs Fnts Pxms Misc Pxm mem Other Total PID Identifier ");
+ mvprintw(4, 0, "res-base Wins GCs Fnts Pxms ShmS Misc Pxm mem Other Total PID Identifier ");
attroff(A_BOLD|A_REVERSE);
}
@@ -565,13 +571,14 @@ xrestop_display(XResTopApp *app)
if (!app->want_batch_mode)
{
- mvprintw(i+5, 0, "%.7x %4d %4d %4d %4d %4d %7s %7s %7s %5s %s",
+ mvprintw(i+5, 0, "%.7x %4d %4d %4d %4d %4d %4d %7s %7s %7s %5s %s",
app->clients[i]->resource_base,
app->clients[i]->n_windows,
app->clients[i]->n_gcs,
app->clients[i]->n_fonts,
app->clients[i]->n_pixmaps,
+ app->clients[i]->n_shmsegs,
app->clients[i]->n_pictures
+ app->clients[i]->n_glyphsets
@@ -603,6 +610,7 @@ xrestop_display(XResTopApp *app)
"\tcolormaps : %d\n"
"\tpassive grabs : %d\n"
"\tcursors : %d\n"
+ "\tshm segments : %d\n"
"\tunknowns : %d\n"
"\tpixmap bytes : %ld\n"
"\tother bytes : ~%ld\n"
@@ -621,6 +629,7 @@ xrestop_display(XResTopApp *app)
app->clients[i]->n_colormaps,
app->clients[i]->n_passive_grabs,
app->clients[i]->n_cursors,
+ app->clients[i]->n_shmsegs,
app->clients[i]->n_other,
app->clients[i]->pixmap_bytes,
app->clients[i]->other_bytes,