summaryrefslogtreecommitdiff
path: root/src/vmon.c
AgeCommit message (Collapse)Author
2022-02-06vmon: suppress "(null)" name in snapshot filenamesVito Caputo
When this code changed to use a local, potentially heap-allocated name variable, it started producing "(null)" when no -n/--name was supplied, that wasn't intended. Just use a "" name when NULL, enabling bare date-derived snapshot filenames. This seems preferable since even if you supplied an empty -n/--name you'd get a hyphen at the start of the name. I can see scenarios where you have unnamed files labeled by the output dir instead.
2022-02-06vmon: remove vestigal puts("DONE!")Vito Caputo
I don't think I intended this to be permanent, though it might be nice to have /something/ printed to signify the transition to breaking the main loop. Something more appropriate can come back if necessary.
2022-02-06vmon: add %P fmt specifier for getpid()Vito Caputo
vmon already handles SIGUSR1 for producing png snapshots on demand, adding a fmt specifier for substituting the vmon PID makes for convenient scripting of triggering such snapshots. i.e: $ vmon -- /bin/bash -c 'for((i = 0; i < 10; i++)); do kill -USR1 %P; sleep 1s; done' Would produce ten png snapshots of the charts on 1-second intervals.
2022-01-27vmon: interpolate command execution argumentsVito Caputo
This adds runtime expansion of the executed command's argv, to support things like passing the vmon X window id to the executed command, session name, and output dir. Format specifiers currently supported by this commit: %W X window id for vmon in hexadecimal %n verbatim name supplied via --name %N filename-safe variant of name supplied via --name %O output directory supplied via --output-dir (or ".") %% literal % There's not curerrently any escaping syntax implemented, relying entirely on %-stuffing to escape interpolation. i.e. use %%N to express %N post-interpolation. This commit also adds SIGINT and SIGQUIT handlers when executing a command. The first such signal received is simply propagated to the child command's process, which upon exiting will trigger the existing SIGCHLD behavior (snapshot if requested, exit). If a subsequent repeated SIGINT or SIGQUIT is received, an abrupt exit is performed without waiting for SIGCHLD or otherwise synchronizing with the child process. The impetus for this is to enable running recordMyDesktop alongside the executed command to record the vmon window while running things like benchmarks or other high-level profiling/CPU usage over time observations. The recordMyDesktop utility already responds to SIGINT for ending a recording, so SIGINT propagation should be sufficient for recording vmon sessions - provided the recordMyDesktop process is positioned to receive signals in the executed command. i.e. is the foreground process or session leader if executed via something like a `/bin/bash -c` construction. Some effort has been made to ensure the vmon window is mapped before running the executed command (XMapWindow() && XSync()). But with SubstructureRedirect in play, as when a window manager is active, this alone isn't sufficient to ensure the window is actually mapped and viewable. This poses a problem with for the current `recordMyDesktop --windowid` implementation, which hard fails when the specified window isn't already mapped and visible. Depending on who wins the race, the window may not yet actually be mapped by the window manager by the time recordMyDesktop queries its attributes. But this is something to fix in recordMyDesktop, even if vmon waited for a MapNotify event before executing the command, the window could become unmapped by the window manager - or maybe it wouldn't even become mapped in a timely fashion if it's placed on a hidden virtual desktop at the time. The recording tool needs to just be more robust in this regard, and should really follow the window around anyways, as well as do things like maybe pause the recording when unmapped, etc. Out of scope for vmon. The aforementioned `recordMyDesktop --windowid` race has been filed as an issue @ https://github.com/recordmydesktop/recordmydesktop/issues/7
2021-11-03vmon: drop unnecessary default: caseVito Caputo
Lack of any statement angers some compilers, just drop it.
2021-09-16vmon: save snapshots on SIGUSR1 as wellVito Caputo
This adds an externally triggered means of snapshotting, which is always available, not only with --snapshot.
2021-09-16vmon: only save SIGCHLD snapshot w/{-s,--snapshot}Vito Caputo
Apparently I never actually made this conditional on the flag...
2021-09-16vmon: rename -{x,y} flags to -{W,H}Vito Caputo
also sort flags alphabetically in help output
2021-09-16vmon: add --version flagVito Caputo
2021-09-16vmon: bump copyright years up to 2021Vito Caputo
2021-09-16vmon: exit w/error on unrecognized flag-like argumentVito Caputo
2021-08-26vmon: bump max --name length in snapshot filenameVito Caputo
16+NUL was clearly too short for descriptive names, pushed it all up to get closer to the common 256 fs limit.
2021-08-26charts: add name to charts overlayVito Caputo
Currently only vmon wires this up to --name, but vwm could get the window title of the window being overlayed and pass that in if set...
2021-08-26vmon: implement --nameVito Caputo
Shows in the window title and the start of snapshot filenames
2021-08-26vmon: implement --snapshotVito Caputo
This implements saving the chart contents to a PNG file created in the output dir upon receiving SIGCHLD.
2021-08-26vmon: implement --output-dirVito Caputo
Preparatory commit; saved PNGs need a place to go, and the user needs a way to control that. Defaults to CWD (".")
2021-08-26vmon: track start timeVito Caputo
Preparatory commit; PNG snapshots will be named using the start time
2021-01-03vmon: handle WM_DELETE_WINDOW client messagesVito Caputo
This makes vmon exit more cooperatively when window managers kindly ask it to with a message rather than requiring XKillClient().
2018-10-23*: update copyright lines to include 2018Vito Caputo
2017-03-27*: update email address: s/gnugeneration/pengaru/Vito Caputo
2017-03-25vmon: two trivial cleanupsVito Caputo
2017-03-25overlays: rename overlays.[ch]->charts.[ch]Vito Caputo
2017-03-25overlays: rename overlays->chartsVito Caputo
vmon introduces a non-overlay usage, monitors is correct but ambiguous, graphs is also amiguous, charts is short and distinctive. renaming of the files comes in a separate, future commit.
2017-03-25*: restore old indentation of switch casesVito Caputo
In the course of applying the new style over the rest of the code I decided it's obnoxiouos and prefer the old way of indenting the cases one level from the switch. I know it wastes horizontal space and can see the value of flattening the cases with the switch, but once you start having variables at the start of the switch body, and blocked cases, it just starts becoming quite unattractive without the indentation.
2017-03-21vmon: uninline is_flag mistaken inlineVito Caputo
I think I've developed a force of habit typing `static inline` after the ray tracer in rototiller.
2017-03-21vmon: introduce vmon utilityVito Caputo
vmon exposes the monitoring overlays of vwm through a standalone commandline utility by creating dedicated window for presenting the overlay. At this time a single preexisting PID may be specified, forming the root of a recursively monitored heirarchy. Alternatively, a command may specified which vmon will then fork and execute on your behalf, automatically monitoring the child and its descendants for you, in a style similar to strace. Examples: Monitor a linux kernel build in fullscreen mode, note the --: `vmon --fullscreen -- make -C /usr/src/linux -j8` Monitor the entire system: `vmon --fullscreen --pid 1` For convenience, omitting --pid and a command to run assumes PID 1: `vmon --fullscreen` is analogous to `vmon --fullscreen --pid 1` Monitor a linux kernel build fullscreen at 50Hz: `vmon --fullscreen --hertz 50 -- make -C /usr/src/linux -j8` Do the same thing but don't exit when the make completes: `vmon --linger --fullscreen --hertz 50 -- make -C /usr/src/linux -j8` Help is provided via `vmon --help`, where you'll find all flags described with their short and long forms. Some important TODO items include: - Support for specifying multiple top-level processes - Support for mixing --pid and running a command (useful for watching specific system processes while you're running something specific) - Support for scrolling within the window. The overlays in general need to evolve a bit to better support the vmon use case. In vwm there wasn't any intention of accomodating the entire space if it exceeded what was naturally available in the existing window's dimensions. That makes sense for vwm, but vmon not so much. You can achieve the same thing more or less by resizing the window to be larger than the screen (easy to do in vwm using a combination of Mod1-Right-Click to resize, then Mod1-Left-Click to drag the window, repeatedly. Then just Mod1-Left-Click to grab the window and "scroll" it by moving the desired part on-screen, repeatedly. Cumbersome, but works fine in a pinch. Not all window managers can do this though... Of course it would be less costly to only render what's visible, like a scrollable window would achieve. This is probably the top priority TODO. - Support for monitoring of memory use, files, per-process IO activity. libvmon supports substantially more than is being visualized currently. - Support for changing the font.
© All Rights Reserved