diff options
-rw-r--r-- | machine/m_linux.c | 4 | ||||
-rw-r--r-- | pg.c | 4 | ||||
-rw-r--r-- | pg_top.c | 19 |
3 files changed, 20 insertions, 7 deletions
diff --git a/machine/m_linux.c b/machine/m_linux.c index 3046acb..b00480a 100644 --- a/machine/m_linux.c +++ b/machine/m_linux.c @@ -649,7 +649,7 @@ read_one_proc_stat(pid_t pid, struct top_proc * proc, struct process_select * se /* full cmd handling */ fullcmd = sel->fullcmd; - if (fullcmd) + if (fullcmd == 1) { sprintf(buffer, "%d/cmdline", pid); if ((fd = open(buffer, O_RDONLY)) != -1) @@ -922,6 +922,8 @@ get_process_info(struct system_info * si, otime = proc->time; read_one_proc_stat(pid, proc, sel); + if (sel->fullcmd == 2) + update_procname(proc, PQgetvalue(pgresult, i, 1)); if (proc->state == 0) continue; @@ -9,11 +9,11 @@ #include "pg_top.h" #define QUERY_PROCESSES \ - "SELECT pid\n" \ + "SELECT pid, query\n" \ "FROM pg_stat_activity;" #define QUERY_PROCESSES_9_1 \ - "SELECT procpid\n" \ + "SELECT procpid, current_query\n" \ "FROM pg_stat_activity;" #define CURRENT_QUERY \ @@ -1201,10 +1201,21 @@ Usage: %s [-ITWbcinqru] [-x x] [-s x] [-o field] [-z username]\n\ case CMD_cmdline: if (statics.flags.fullcmds) { - ps.fullcmd = !ps.fullcmd; - new_message(MT_standout | MT_delayed, - " %sisplaying full command lines.", - ps.fullcmd ? "D" : "Not d"); + ps.fullcmd = (ps.fullcmd + 1) % 3; + switch (ps.fullcmd) { + case 2: + new_message(MT_standout | MT_delayed, + " Displaying current query."); + break; + case 1: + new_message(MT_standout | MT_delayed, + " Displaying full command lines."); + break; + case 0: + default: + new_message(MT_standout | MT_delayed, + " Not displaying full command lines."); + } } else { |