summaryrefslogtreecommitdiff
path: root/src/bootchart
AgeCommit message (Collapse)Author
2015-10-27util-lib: introduce dirent-util.[ch] for directory entry callsLennart Poettering
Also, move a couple of more path-related functions to path-util.c.
2015-10-27util-lib: split string parsing related calls from util.[ch] into parse-util.[ch]Lennart Poettering
2015-10-26util-lib: split out IO related calls to io-util.[ch]Lennart Poettering
2015-10-25util-lib: split out fd-related operations into fd-util.[ch]Lennart Poettering
There are more than enough to deserve their own .c file, hence move them over.
2015-10-24util-lib: split our string related calls from util.[ch] into its own file ↵Lennart Poettering
string-util.[ch] There are more than enough calls doing string manipulations to deserve its own files, hence do something about it. This patch also sorts the #include blocks of all files that needed to be updated, according to the sorting suggestions from CODING_STYLE. Since pretty much every file needs our string manipulation functions this effectively means that most files have sorted #include blocks now. Also touches a few unrelated include files.
2015-09-30bootchart: use get_proc_field and PROC_CPUINFO_MODELAaro Koskinen
Use get_proc_field and PROC_CPUINFO_MODEL to get the CPU type. Also don't fail if it missing, instead restore the old behaviour and print "Unknown". Fixes the following error seen with v225 on powerpc: Unable to read module name from cpuinfo. Error generating svg file: No such file or directory
2015-09-09Merge pull request #1218 from poettering/safe-fcloseDaniel Mack
util: introduce safe_fclose() and port everything over to it
2015-09-09util: introduce safe_fclose() and port everything over to itLennart Poettering
Adds a coccinelle script to port things over automatically.
2015-09-09tree-wide: replace while(1) by for(;;) everywhereLennart Poettering
Another Coccinelle script.
2015-09-09tree-wide: update empty-if coccinelle script to cover empty-while and moreLennart Poettering
Let's also clean up single-line while and for blocks.
2015-09-09tree-wide: drop {} from one-line if blocksLennart Poettering
Patch via coccinelle.
2015-08-03tree-wide: convert bootchart and lldp code to use clock_boottime_or_monotonic()Lennart Poettering
We should avoid using CLOCK_BOOTTIME directly unless we actually can sensible distuingish it from CLOCK_MONOTONIC. CLOCK_BOOTTIME is only fully feature on very recent Linux kernels, hence we should stick to a fallback logic, which is already available in the clock_boottime_or_monotonic() call.
2015-07-21bootchart: fix negative 'timeleft' conditionDaniel Mack
Fix the overrun case in sample acquistion and negative number calculations. Reported by Stefan Sauer. Fixes #642
2015-07-01bootchart: do not report warning when disk is missing model.Dimitri John Ledkov
In VMs / virtio drives there is no model. Also don't print "Disk: (null)" in output if no model is available.
2015-06-30bootchart: Ensure that /proc/schedstat is read entirelyGianpaolo Macario
On multi-core systems file /proc/schedstat may be larger than 4096 bytes and pread() will only read part of it. Fix issue https://github.com/systemd/systemd/issues/404
2015-06-28bootchart: reset list_sample_data head before generating SVGGianpaolo Macario
Until commit 1f2ecb0 ("bootchart: kill a bunch of global variables") variable "head" was declared global and this action was performed by svg_header. Now that "head" is local and passed to each function called by svg_do(...) move the code at the beginning of svg_do(...) to restore the correct behaviour.
2015-06-25bootchart: Account CPU time spent in non-main threads of processes (v5)Gianpaolo Macario
Fix for issue https://github.com/systemd/systemd/issues/139 - Implement fixes suggested by @teg to -v2 - Implement fixes suggested by @zonque to -v3 and -v4
2015-06-23bootchart: fix per-cpu scales.Dimitri John Ledkov
Closes systemd/systemd#330
2015-06-05systemd-bootchart: Trivial typo fix in warningGianpaolo Macario
Signed-off-by: Gianpaolo Macario <gmacario@gmail.com>
2015-04-24bootchart: kill newline characters from log_error_errno() callsDaniel Mack
2015-04-05bootchart: fix check for no fdShawn Landden
found with coverty report
2015-04-03bootchart: assorted coding style fixesDaniel Mack
* kill unnecessary {} * add newlines where appropriate * remove dead code * reorder variable declarations * fix more return code logic * pass O_CLOEXEC to all open*() calles * use safe_close() where possible
2015-04-03bootchart: kill a bunch of global variablesDaniel Mack
This code is in a confusingly bad shape. Kill a bunch of global variables and pass needed variables around in function calls.
2015-04-03bootchart: clean up sysfd and proc handlingDaniel Mack
Retrieve the handle to procfs in main(), and pass it functions that need it. Kill the global variables. Also, refactor lots of code in svg_title(). There's no need to access any global variables from there either, and we really should return proper errors from there as well.
2015-04-03bootchart: clean up control flow logicDaniel Mack
Don't blindly exit() from random functions, but return a proper error and upchain error conditions. squash! bootchart: clean up control flow logic When pread() returns "0", it's a read failure, so don't make the caller think log_sample() was successful, return meaningful error code instead of 0.
2015-04-03bootchart: switch to log_* helpersDaniel Mack
Let the helper functions take care of the string message output.
2015-03-30systemd-bootchart: Repair Entropy GraphAlexander Sverdlin
Entropy Graph code doesn't handle the error condition if open() of /proc entry fails. Moreover, the file is only opened once and only first sample will contain the correct value because the return value of pread() is also not handled properly and file is not re-opened. Fix both problems.
2015-03-30systemd-bootchart: Prevent leaking file descriptors in open-fdopen combinationAlexander Sverdlin
Correctly handle the potential failure of fdopen() (because of OOM, for instance) after potentially successful open(). Prevent leaking open fd in such case.
2015-03-30systemd-bootchart: Prevent closing random file descriptorsAlexander Sverdlin
If the kernel has no CONFIG_SCHED_DEBUG option set, systemd-bootchart produces empty .svg file. The reason for this is very fragile file descriptor logic in log_sample() and main() (/* do some cleanup, close fd's */ block). There are many places where file descriptors are closed on failure (missing SCHED_DEBUG provokes it), but there are several problems with it: - following iterations in the loop see that the descriptor is non zero and do not open the corresponding file again; - "some cleanup" code closes already closed files and the descriptors are reused already, in particular for resulting .svg file; - static "vmstat" and "schedstat" variables in log_sample() made the situation even worse. These are the strace fragments: [...] close(7) = -1 EBADF (Bad file descriptor) close(-1) = -1 EBADF (Bad file descriptor) pread(7, 0xbea60a2c, 4095, 0) = -1 EBADF (Bad file descriptor) close(7) = -1 EBADF (Bad file descriptor) close(-1) = -1 EBADF (Bad file descriptor) pread(7, 0xbea60a2c, 4095, 0) = -1 EBADF (Bad file descriptor) close(7) = -1 EBADF (Bad file descriptor) close(-1) = -1 EBADF (Bad file descriptor) getdents64(4, /* 0 entries */, 32768) = 0 clock_gettime(CLOCK_MONOTONIC, {24, 783843501}) = 0 nanosleep({0, 5221792}, NULL) = 0 clock_gettime(CLOCK_MONOTONIC, {24, 789726835}) = 0 lseek(4, 0, SEEK_SET) = 0 pread(5, "nr_free_pages 52309\nnr_alloc_bat"..., 4095, 0) = 685 pread(6, "version 15\ntimestamp 4294939775\n"..., 4095, 0) = 86 getdents64(4, /* 99 entries */, 32768) = 2680 pread(7, 0xbea60a2c, 4095, 0) = -1 EBADF (Bad file descriptor) close(7) = -1 EBADF (Bad file descriptor) close(-1) = -1 EBADF (Bad file descriptor) pread(8, 0xbea60a2c, 4095, 0) = -1 EBADF (Bad file descriptor) close(8) = -1 EBADF (Bad file descriptor) close(-1) = -1 EBADF (Bad file descriptor) pread(9, 0xbea60a2c, 4095, 0) = -1 EBADF (Bad file descriptor) close(9) = -1 EBADF (Bad file descriptor) [...] where it obviously tries to close same and reused decriptors many times, also passing return code "-1" instead of descriptor... [...] close(7) = -1 EBADF (Bad file descriptor) close(-1) = -1 EBADF (Bad file descriptor) pipe2([7, 8], O_CLOEXEC) = 0 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb6fd0068) = 192 close(8) = 0 fcntl64(7, F_SETFD, 0) = 0 fstat64(7, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb6fd2000 read(7, "[ 0.074507] calling vfp_init"..., 4096) = 4096 [...] read(7, "s)\n[ 6.228910] UBIFS: reserve"..., 4096) = 4096 read(7, "trary Executable File Formats Fi"..., 4096) = 1616 read(7, "", 4096) = 0 close(7) = 0 wait4(192, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 192
2015-03-24bootchart: more useful error message for common errorShawn Landden
Reported-by: tfirg_ on IRC
2015-03-24bootchart: remove duplicated code, prevent creating empty filesShawn Landden
In Debian and rawhide Fedora, which have CONFIG_SCHEDSTATS=n, bootchart creates empty files in /run/log before printing an error. Stop doing that. Moreover this duplicated part of the code doesn't even have error checking so there is no error avoided by doing this early. Reported-by: tfirg_ on IRC
2015-03-10Add type specifier for intThomas Hindoe Paaboel Andersen
2015-03-09bootchart: use _cleanup_Zbigniew Jędrzejewski-Szmek
2015-03-03Do not advertise .d snippets over main config fileZbigniew Jędrzejewski-Szmek
For daemons which have a main configuration file, there's little reason for the administrator to use configuration snippets. They are useful for packagers which need to override settings, but we shouldn't advertise that as the main way of configuring those services. https://bugs.freedesktop.org/show_bug.cgi?id=89397
2015-02-24bootchart: svg: fix checking of list endAaro Koskinen
If we have less samples than expected, systemd-bootchart will crash.
2015-02-24bootchart: fix default init pathMartin Pitt
Commit 6e1bf7ab99 used the wrong directory; we need rootlibexecdir, not rootlibdir, as the latter is something like /lib/x86_64-linux-gnu/ on multi-arch systems. https://launchpad.net/bugs/1423867
2015-02-23remove unused includesThomas Hindoe Paaboel Andersen
This patch removes includes that are not used. The removals were found with include-what-you-use which checks if any of the symbols from a header is in use.
2015-02-14bootchart: display each CPU utilization/waitWaLyong Cho
2015-02-02bootchart: Ensure that systemd is the init called after using bootchartSebastien Bacher
When booting with systemd-bootchart, default to call the systemd binary rather than the init binary on disk, which might be another init system. Collecting data only works with booting systemd.
2014-12-04bootchart: escape non printable process nameWaLyong Cho
2014-11-29bootchart: Support bootchart.conf.d directories in the usual search pathsJosh Triplett
2014-11-28treewide: use log_*_errno whenever %m is in the format stringMichal Schmidt
If the format string contains %m, clearly errno must have a meaningful value, so we might as well use log_*_errno to have ERRNO= logged. Using: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\((".*%m.*")/log_\1_errno(errno, \2/' Plus some whitespace, linewrap, and indent adjustments.
2014-11-28treewide: more log_*_errno() conversions, multiline callsMichal Schmidt
Basically: find . -name '*.[ch]' | while read f; do perl -i.mmm -e \ 'local $/; local $_=<>; s/log_(debug|info|notice|warning|error|emergency)\("([^"]*)%s"([^;]*),\s*strerror\(-?([->a-zA-Z_]+)\)\);/log_\1_errno(\4, "\2%m"\3);/gms;print;' \ $f; done Plus manual indentation fixups.
2014-11-28treewide: no need to negate errno for log_*_errno()Michal Schmidt
It corrrectly handles both positive and negative errno values.
2014-11-28treewide: auto-convert the simple cases to log_*_errno()Michal Schmidt
As a followup to 086891e5c1 "log: add an "error" parameter to all low-level logging calls and intrdouce log_error_errno() as log calls that take error numbers", use sed to convert the simple cases to use the new macros: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\("(.*)%s"(.*), strerror\(-([a-zA-Z_]+)\)\);/log_\1_errno(-\4, "\2%m"\3);/' Multi-line log_*() invocations are not covered. And we also should add log_unit_*_errno().
2014-10-03bootchart: use 'n/a' if PRETTY_NAME is not foundThomas Hindoe Paaboel Andersen
Spotted with coverity. If parsing both /etc/os-release and /usr/lib/os-release fails then null would be passed on. The calls to parse the two files are allowed to fail. A empty /etc may not have had the /etc/os-release symlink restored yet and we just try again in the loop. If for whatever reason that does not happen then we now pass on 'n/a' instead of null.
2014-09-28bootchart: Do not try to access data for non-existing CPU'sPhilippe De Swert
Cpu's are assigned normally, so starting at 0, so the MAX_CPU index will always be one smaller than the actual number. Found with Coverity.
2014-09-28bootchart: check return of strftimeThomas Hindoe Paaboel Andersen
Found by coverity. Fixes: CID#996314 and #996312
2014-09-28bootchart: parse userinput with safe_atoiThomas Hindoe Paaboel Andersen
Found by coverity. Fixes: CID#996409
2014-09-16bootchart: oom-check correct variableAndreas Henriksson
Coverity warned that we have already dereferenced ps->sample before null-checking it. I suspect that's not really the issue and that the check is checking the wrong variable. Likely the oom-check should be on the just allocated ps->sample->next. Found by coverity. Fixes: CID#1237765