Commit Graph

47 Commits

Author SHA1 Message Date
Lennart Poettering 57255510c9 tree-wide: replace while(1) by for(;;) everywhere
Another Coccinelle script.
2015-09-09 14:59:53 +02:00
Lennart Poettering ece174c543 tree-wide: drop {} from one-line if blocks
Patch via coccinelle.
2015-09-09 08:20:20 +02:00
Dimitri John Ledkov 4e5356169a bootchart: do not report warning when disk is missing model.
In VMs / virtio drives there is no model. Also don't print "Disk:
(null)" in output if no model is available.
2015-07-01 14:49:20 +01:00
Gianpaolo Macario ae87a4a929 bootchart: reset list_sample_data head before generating SVG
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-28 17:30:47 +00:00
Dimitri John Ledkov 75034e5836 bootchart: fix per-cpu scales.
Closes systemd/systemd#330
2015-06-23 15:25:17 +01:00
Daniel Mack 5d236c1f42 bootchart: kill newline characters from log_error_errno() calls 2015-04-24 21:51:43 +02:00
Daniel Mack af672f03ec bootchart: assorted coding style fixes
* 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-03 15:29:18 +02:00
Daniel Mack 1f2ecb0393 bootchart: kill a bunch of global variables
This code is in a confusingly bad shape. Kill a bunch of global variables
and pass needed variables around in function calls.
2015-04-03 15:29:18 +02:00
Daniel Mack f91781329c bootchart: clean up sysfd and proc handling
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-03 15:29:18 +02:00
Daniel Mack 0399586320 bootchart: switch to log_* helpers
Let the helper functions take care of the string message output.
2015-04-03 15:29:18 +02:00
Alexander Sverdlin 58ec01b35c systemd-bootchart: Prevent leaking file descriptors in open-fdopen combination
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-30 09:37:11 +02:00
Aaro Koskinen c1682f17a0 bootchart: svg: fix checking of list end
If we have less samples than expected, systemd-bootchart will crash.
2015-02-24 23:51:55 -05:00
Thomas Hindoe Paaboel Andersen 2eec67acbb remove unused includes
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-23 23:53:42 +01:00
WaLyong Cho 749806b389 bootchart: display each CPU utilization/wait 2015-02-14 10:25:03 -05:00
WaLyong Cho 3f18c60b2e bootchart: escape non printable process name 2014-12-04 02:10:41 +01:00
Thomas Hindoe Paaboel Andersen e931d3f424 bootchart: check return of strftime
Found by coverity. Fixes: CID#996314 and #996312
2014-09-28 14:46:38 +02:00
Lennart Poettering a2715692e2 bootchart: use the bool type where appropriate 2014-08-11 18:24:08 +02:00
Thomas Hindoe Paaboel Andersen 8271bd16ce bootchart: add assert
since 376cd3b89c LIST_FIND_TAIL accepts
an empty list. That removed an assert in LIST_FIND_TAIL and we now
theoretically risk a null pointer deref. This adds the assert directly
to protect against that.
2014-06-19 00:18:05 +02:00
Frederic Crozat a7997073ac bootchart: set white background
In programs like eog and gimp the transparant background did not
look very good.

Similar fix from the one done in systemd-analyze (418e3750)
2014-06-17 11:34:31 +02:00
WaLyong Cho 49e5b2a933 bootchart: add control group option 2014-04-24 19:21:51 -04:00
Greg KH 29804cc1e0 use memzero(foo, length); for all memset(foo, 0, length); calls
In trying to track down a stupid linker bug, I noticed a bunch of
memset() calls that should be using memzero() to make it more "obvious"
that the options are correct (i.e. 0 is not the length, but the data to
set).  So fix up all current calls to memset(foo, 0, length) to
memzero(foo, length).
2014-01-31 11:55:01 +01:00
Dan McGee 4987623d01 Bring bootchart code in line with CODING_STYLE
Use double and not float, as there is little to no benefit.
2013-12-10 07:40:55 -05:00
Thomas Hindoe Paaboel Andersen 272bf69e98 bootchart: remove dead assignment 2013-12-08 22:28:37 +01:00
Thomas Hindoe Paaboel Andersen f168c27313 trivial coding style clean ups
- Add space between if/for and the opening parentheses
- Place the opening brace on same line as the function (not for  udev)

From the CODING_STYLE
Try to use this:
    void foo() {
    }
instead of this:
    void foo()
    {
    }
2013-12-03 22:27:45 +01:00
Lennart Poettering 71fda00f32 list: make our list macros a bit easier to use by not requring type spec on each invocation
We can determine the list entry type via the typeof() gcc construct, and
so we should to make the macros much shorter to use.
2013-10-14 06:11:19 +02:00
Zbigniew Jędrzejewski-Szmek 872c8faaf2 Fix write-only use of a few variables
Since the invention of read-only memory, write-only memory has been
considered deprecated. Where appropriate, either make use of the
value, or avoid writing it, to make it clear that it is not used.
2013-10-13 17:56:54 -04:00
Jason St. John 3c527fd195 bootchart: fix typos in copyright notices
"Corporation" was misspelled as "Coproration"
2013-06-12 01:40:02 -04:00
Nathaniel Chen 8dfb6e718d Dynamically allocate bootchart logs
Instead of storing bootchart sample data in arrays, this patch moves
storage to linked lists so that there is no more limit on samples.

This patch also fixes parsing of /proc/<pid>/smaps in kernels > 3.7.
2013-05-02 09:23:01 -07:00
Harald Hoyer 7fd1b19bc9 move _cleanup_ attribute in front of the type
http://lists.freedesktop.org/archives/systemd-devel/2013-April/010510.html
2013-04-18 09:11:22 +02:00
Zbigniew Jędrzejewski-Szmek 1c6330456c Use initalization instead of explicit zeroing in more places 2013-04-10 18:59:42 -04:00
Cristian Rodríguez 9607d9470e Always use our own MAX/MIN definitions
code in src/shared/macro.h only defined MAX/MIN in case
they were not defined previously. however the MAX/MIN
macros implemented in glibc are not of the "safe" kind but defined
as:

define MIN(a,b) (((a)<(b))?(a):(b))
define MAX(a,b) (((a)>(b))?(a):(b))

Avoid nasty side effects by using our own versions instead.

Also fix the warnings derived from this change.

[zj: - modify MAX3 macro to fix warning about _a shadowing _a,
     - do bootchart/svg.c too,
     - remove unused MIN3.]
2013-04-01 23:43:48 -04:00
Zbigniew Jędrzejewski-Szmek 4dd1de72e8 Remove some dead code
Based on coverity report.
2013-03-31 14:28:36 -04:00
Zbigniew Jędrzejewski-Szmek 40c2cce772 bootchart: fix two unitialized memory frees
The new gcc isn't bad!

In file included from src/bootchart/svg.c:36:0:
src/bootchart/svg.c: In function 'svg_ps_bars':
./src/shared/util.h:524:13: warning: 'enc_name' may be used uninitialized in this function [-Wmaybe-uninitialized]
         free(*(void**) p);
             ^
src/bootchart/svg.c:821:37: note: 'enc_name' was declared here
                 char _cleanup_free_*enc_name;
                                     ^
  CC     src/udev/mtd_probe/mtd_probe-probe_smartmedia.o
  XSLT     man/systemd.unit.5
In file included from src/bootchart/svg.c:36:0:
src/bootchart/svg.c: In function 'svg_pss_graph':
./src/shared/util.h:524:13: warning: 'enc_name' may be used uninitialized in this function [-Wmaybe-uninitialized]
         free(*(void**) p);
             ^
src/bootchart/svg.c:395:37: note: 'enc_name' was declared here
                 char _cleanup_free_*enc_name;
                                     ^
2013-03-21 22:39:23 -04:00
Lennart Poettering 6d031c0b60 bootchart: various superficial cleanups
Let's update bootchar to share the coding style a bit more with the rest
of the package.

- Some tabs/spaces fixes

- add #pragma to header

- split up header so that we have a 1:1 relation between .c and .h files
  like everywhere else

- Prefix user command line arguments/configuration settings with "arg_".

- other coding style fixes
2013-03-11 22:47:58 +01:00
Zbigniew Jędrzejewski-Szmek 1f3523baf7 Revert "bootchart: use _cleanup_close_"
This reverts commit 0ea9530d40.

attribute(cleanup) can only be used inside functions (*of, sysfd
are leaked).

Cleanup functions are only called once when exiting scope (*f
is leaked twice).
2013-03-07 15:35:50 -05:00
Nathaniel Chen 0ea9530d40 bootchart: use _cleanup_close_
use _cleanup_{close_,fclose_} to close streams and file descriptors
2013-03-07 20:53:14 +01:00
Harald Hoyer b9a496c166 bootchart: rename global len to samples_len 2013-03-07 16:09:25 +01:00
Harald Hoyer e90f9fa4d1 bootchart: add parameter "-C" to expand process names to the full cmdline 2013-03-07 16:09:22 +01:00
Harald Hoyer 8846199d20 bootchart: if "root=/dev" is not matched, don't try to read /sys 2013-02-14 13:49:48 -08:00
Harald Hoyer e93450c6c0 bootchart: parse /etc/os-release rather than system-release
Also parse it early, so that we can get it in the initramfs.
2013-02-14 11:59:16 -08:00
Harald Hoyer b823b5e272 bootchart: more fixes for bootchart in the initramfs 2013-02-14 11:55:23 -08:00
William Giokas 895aeb2779 man: bootchart: change /var/log to /run/log
As of [1], bootchart stores files in /run/log, not /var/log, by default.

[1] f2f85884ca
2013-02-13 15:26:55 -08:00
William Giokas 6bb25a0582 bootchart: Fix typos and some English
bootchart.conf: direct users to `bootchart.conf(5)`, not a nonexistent
man page.

svg.c: Fix some English in the svg comment header.
  * Chrome/Chromium => Chrome, Chromium
  * firefox => Firefox
  * much more slow => more slowly
2013-02-13 05:03:48 +01:00
Auke Kok cd3bccaaf7 systemd-bootchart: relicense to LGPLv2.1+
When we merged systemd-bootchart we omitted relicensing this
to LGPL. Now that code is being used for other purposes we
need to make sure the code is shareable within systemd
without further problems.

The original committers and contributors of bootchart before it
was merged all have agreed with the relicensing.
2013-02-12 15:14:15 -08:00
Zbigniew Jędrzejewski-Szmek e985665d2d Add _cleanup_pclose_ and fix mismatching pipe close opened by popen()
Based-on-patch-by: Thomas Jarosch <thomas.jarosch@intra2net.com>

cppcheck reported:
[src/bootchart/svg.c:791]: (error) Mismatching allocation and deallocation: f
2013-01-25 10:38:42 -05:00
Thomas Hindoe Paaboel Andersen 28989b63f5 bootchart: tabs to spaces 2013-01-10 00:24:48 +01:00
Auke Kok 83fdc450aa bootchart: merge bootchart
Bootchart is renamed to 'systemd-bootchart' and installed as
/usr/lib/systemd/systemd-bootchart. The configuration file
will reside in /etc/systemd/bootchart.conf.
2013-01-07 23:48:43 +01:00