Hello community, here is the log from the commit of package smemstat for openSUSE:Factory checked in at 2019-01-21 10:58:02 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/smemstat (Old) and /work/SRC/openSUSE:Factory/.smemstat.new.28833 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "smemstat" Mon Jan 21 10:58:02 2019 rev:6 rq:666480 version:0.02.03 Changes: -------- --- /work/SRC/openSUSE:Factory/smemstat/smemstat.changes 2018-11-27 10:46:38.387936037 +0100 +++ /work/SRC/openSUSE:Factory/.smemstat.new.28833/smemstat.changes 2019-01-21 10:58:46.119398744 +0100 @@ -1,0 +2,8 @@ +Sat Jan 12 12:38:02 UTC 2019 - mar...@gmx.de + +- Update to version 0.02.03 + * Don't emit "Note: Mmeory reported in units..." message in quiet mode + * Don't emit Change in memory message in quiet mode + * Make structs pack more efficiently + +------------------------------------------------------------------- Old: ---- smemstat-0.02.01.tar.xz New: ---- smemstat-0.02.03.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ smemstat.spec ++++++ --- /var/tmp/diff_new_pack.17ONty/_old 2019-01-21 10:58:46.643398062 +0100 +++ /var/tmp/diff_new_pack.17ONty/_new 2019-01-21 10:58:46.647398057 +0100 @@ -1,7 +1,7 @@ # # spec file for package smemstat # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # Copyright (c) 2017, Martin Hauke <mar...@gmx.de> # # All modifications and additions to the file contributed by third parties @@ -13,20 +13,20 @@ # license that conforms to the Open Source Definition (Version 1.9) # published by the Open Source Initiative. -# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# Please submit bugfixes or comments via http://bugs.opensuse.org/ # Name: smemstat -Version: 0.02.01 +Version: 0.02.03 Release: 0 Summary: Memory usage monitoring tool License: GPL-2.0-or-later Group: System/Monitoring -Url: http://kernel.ubuntu.com/~cking/smemstat/ -Source: http://kernel.ubuntu.com/~cking/tarballs/%{name}/%{name}-%{version}.tar.xz +URL: https://kernel.ubuntu.com/~cking/smemstat/ +Source: https://kernel.ubuntu.com/~cking/tarballs/%{name}/%{name}-%{version}.tar.xz +BuildRequires: pkgconfig BuildRequires: pkgconfig(ncursesw) -BuildRoot: %{_tmppath}/%{name}-%{version}-build %description Smemstat reports the physical memory usage taking into consideration shared @@ -44,9 +44,8 @@ %make_install %files -%defattr(-,root,root) -%doc COPYING +%license COPYING %{_bindir}/smemstat -%{_mandir}/man8/smemstat.8%{ext_man} +%{_mandir}/man8/smemstat.8%{?ext_man} %changelog ++++++ smemstat-0.02.01.tar.xz -> smemstat-0.02.03.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/smemstat-0.02.01/Makefile new/smemstat-0.02.03/Makefile --- old/smemstat-0.02.01/Makefile 2018-07-10 10:24:17.000000000 +0200 +++ new/smemstat-0.02.03/Makefile 2018-09-23 12:10:50.000000000 +0200 @@ -16,7 +16,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # -VERSION=0.02.01 +VERSION=0.02.03 # CFLAGS += -Wall -Wextra -DVERSION='"$(VERSION)"' -O2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/smemstat-0.02.01/smemstat.8 new/smemstat-0.02.03/smemstat.8 --- old/smemstat-0.02.01/smemstat.8 2018-07-10 10:24:17.000000000 +0200 +++ new/smemstat-0.02.03/smemstat.8 2018-09-23 12:10:50.000000000 +0200 @@ -2,7 +2,7 @@ .\" First parameter, NAME, should be all caps .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" other parameters are allowed: see man(7), man(1) -.TH SMEMSTAT 8 "April 14, 2017" +.TH SMEMSTAT 8 "August 30, 2018" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: @@ -47,6 +47,9 @@ .SH OPTIONS smemstat options are as follow: .TP +.B \-a +show memory size change with up arrow \[u2191] (increase) and down arrow \[u2193] (decrease) +.TP .B \-c get command information from processes comm field .TP @@ -86,6 +89,9 @@ .TP .B \-T top mode, show top consumers of memory +.PP +When running in 'top mode', pressing 'q' will quit, 'a' toggles the memory +change arrow, 't' toggles the top comsumers of memory view. .SH SEE ALSO .BR cpustat (8), .BR eventstat (8), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/smemstat-0.02.01/smemstat.c new/smemstat-0.02.03/smemstat.c --- old/smemstat-0.02.01/smemstat.c 2018-07-10 10:24:17.000000000 +0200 +++ new/smemstat-0.02.03/smemstat.c 2018-09-23 12:10:50.000000000 +0200 @@ -63,17 +63,17 @@ /* process specific information */ typedef struct proc_info { + struct proc_info *next; /* next in hash */ + char *cmdline; /* Process name from cmdline */ pid_t pid; /* PID */ bool kernel_thread; /* true if process is kernel thread */ - char *cmdline; /* Process name from cmdline */ - struct proc_info *next; /* next in hash */ } proc_info_t; /* UID cache */ typedef struct uname_cache_t { - uid_t uid; /* User UID */ - char * name; /* User name */ struct uname_cache_t *next; + char * name; /* User name */ + uid_t uid; /* User UID */ } uname_cache_t; /* wakeup event information per process */ @@ -91,17 +91,16 @@ int64_t d_pss; /* Delta PSS */ int64_t d_uss; /* Delta USS */ int64_t d_swap; /* Delta swap */ - bool alive; /* true if proc is alive */ - struct mem_info_t *d_next; /* sorted deltas by total */ struct mem_info_t *s_next; /* sorted by total */ struct mem_info_t *next; /* for free list */ + bool alive; /* true if proc is alive */ } mem_info_t; typedef struct pid_list { - pid_t pid; /* process id */ - char *name; /* process name */ struct pid_list *next; /* next in list */ + char *name; /* process name */ + pid_t pid; /* process id */ } pid_list_t; typedef struct { @@ -440,7 +439,7 @@ static void mem_to_str(const double val, char *buf, const size_t buflen) { double s; - double v = (val < 0) ? -val : val; + double v = (val < 0.0) ? -val : val; char unit; (void)memset(buf, 0, buflen); @@ -491,7 +490,8 @@ else if (opt_flags & OPT_MEM_IN_GBYTES) unit = "giga"; - (void)printf("Note: Memory reported in units of %sbytes.\n", unit); + if (!(opt_flags & OPT_QUIET)) + (void)printf("Note: Memory reported in units of %sbytes.\n", unit); } /* @@ -1188,8 +1188,9 @@ } if (!(opt_flags & OPT_QUIET)) - df.df_printf(" %*.*s Swap USS PSS RSS D User Command\n", - pid_size, pid_size, "PID"); + df.df_printf(" %*.*s Swap USS PSS RSS %sUser Command\n", + pid_size, pid_size, "PID", + opt_flags & OPT_ARROW ? "D " : ""); for (m = sorted; m; m = m->s_next) { const char *cmd = mem_cmdline(m); @@ -1201,11 +1202,14 @@ if (!(opt_flags & OPT_QUIET)) { int64_t delta = m->d_swap + m->d_uss + m->d_pss + m->d_rss; - const char * const arrow = delta < 0 ? "\u2193" : (delta > 0 ? "\u2191" : " "); + const char * const arrow = (delta < 0) ? "\u2193 " : + ((delta > 0) ? "\u2191 " : " "); - df.df_printf(" %*d %9s %9s %9s %9s %s %-10.10s %s\n", + df.df_printf(" %*d %9s %9s %9s %9s %s%-10.10s %s\n", pid_size, m->pid, s_swap, s_uss, s_pss, s_rss, - one_shot ? " " : arrow, uname_name(m->uname), cmd); + one_shot ? " " : + opt_flags & OPT_ARROW ? arrow : "", + uname_name(m->uname), cmd); } if (json) { @@ -1486,6 +1490,7 @@ (void)printf("%s, version %s\n\n" "Usage: %s [options] [duration] [count]\n" "Options are:\n" + " -a\t\tshow memory change with up/down arrows\n" " -c\t\tget command name from processes comm field\n" " -d\t\tstrip directory basename off command information\n" " -g\t\treport memory in gigabytes\n" @@ -1518,7 +1523,7 @@ df = df_normal; for (;;) { - int c = getopt(argc, argv, "cCdghklmo:p:qstT"); + int c = getopt(argc, argv, "acCdghklmo:p:qstT"); if (c == -1) break; @@ -1649,7 +1654,7 @@ exit(EXIT_FAILURE); } - if (!(opt_flags & OPT_TOP)) + if (!(opt_flags & (OPT_TOP | OPT_QUIET))) (void)printf("Change in memory (average per second):\n"); (void)memset(&new_action, 0, sizeof(new_action)); @@ -1684,6 +1689,7 @@ while (!stop_smemstat && (forever || count--)) { struct timeval tv; double secs; + int nchar; df.df_clear(); cury = 0; @@ -1723,6 +1729,28 @@ } } + nchar = 0; + if ((ioctl(0, FIONREAD, &nchar) == 0) && (nchar > 0)) { + char ch; + + nchar = read(0, &ch, 1); + if (nchar == 1) { + switch (ch) { + case 'q': + case 'Q': + case 27: + stop_smemstat = true; + break; + case 'a': + opt_flags ^= OPT_ARROW; + break; + case 't': + opt_flags ^= OPT_TOP_TOTAL; + break; + } + } + } + if (mem_get_all_pids(&mem_info_new, &npids) < 0) goto free_cache;