A feature request -- '-l 0:99:99', or custom profiles
Hi there -- thank you for a great program, it is an absolute joy to use!
Do you think it is possible to have a several atop aliases targeting disk activity, cpu etc, and save even more keystrokes? This would also make scripting in batch mode a bit easier.
In particular, when debugging disk-related issues, it is nice to have limitedlines() setting maxcpulines = 0, but keeping maxdsklines big.
If there were syntax like atop -l 0:99:99:.. to set these limits, or an option to have a custom rc file, one could make a few different atop aliases like atopd=atop -l 0:99:99:... or atopd=atop --rcfile=atoprc.disk ; I can see a quick and dirty way to have a custom rc file using an environment variable, but I'm not sure if that would go with the general style:
====
$ diff -u atop.c.2017-10-07 atop.c
--- atop.c.2017-10-07 2017-10-07 22:25:26.079844329 +1100
+++ atop.c 2017-10-07 23:21:27.239578628 +1100
@@ -466,14 +466,32 @@
*/
readrc("/etc/atoprc", 1);
- if ( (p = getenv("HOME")) )
+ /* for local atoprc, p == NULL will mean "file not found" */
+ p = NULL ; /* NULL : no local rcfile */
+
+ /* try $ATOPRC first */
+ if ( (p = getenv("ATOPRC")) )
{
- char path[1024];
+ /* if we can read it -- let's read it */
+ if( access( p, R_OK ) != -1 ) {
+ readrc(p, 0);
+ } else {
+ /* if we can't -- let's try HOME next */
+ p = NULL ;
+ }
+ }
+
+ /* go for $HOME/.atoprc next */
+ if ( ( NULL == p ) ) {
+ if ( (p = getenv("HOME")) )
+ {
+ char path[1024];
- snprintf(path, sizeof path, "%s/.atoprc", p);
+ snprintf(path, sizeof path, "%s/.atoprc", p);
- readrc(path, 0);
- }
+ readrc(path, 0);
+ }
+ }
/*
** check if we are supposed to behave as 'atopsar'
====