Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 345695

Summary: app-benchmarks/bootchart2-0.12.4.ebuild (New Package)
Product: Gentoo Linux Reporter: Gustavo Sverzut Barbieri <barbieri>
Component: New packagesAssignee: Justin Lecher (RETIRED) <jlec>
Status: RESOLVED FIXED    
Severity: normal CC: bj.rn, btarquini, hsggebhardt, kanelxake, lucianm, nikoli
Priority: High    
Version: unspecified   
Hardware: All   
OS: Linux   
URL: https://github.com/mmeeks/bootchart
Whiteboard:
Package list:
Runtime testing required: ---
Attachments: app-benchmarks/bootchart2-0.12.4.ebuild
new version with TASK_DELAY_ACCT check
enhanced ebuild, also for 0.12.6
use variable instead of hardcoded /lib/bootchart/bootchart-collector
second patch, making LIBDIR changeable
updated ebuild after upstream integration of the 2 patches above
adds CUSTOM_POST_CMD which is executed after data collection and rendering
init script to start collector without initrd
init script to stop the collector if started from initrd
bootchartd help message
updated ebuild
initscript for bootchart
updated init script
updated ebuild, added ramdisk hint also in postinst message
updated ebuild, for version 0.14.0
Look for bootchart_init in the environment

Description Gustavo Sverzut Barbieri 2010-11-16 01:58:39 UTC
bootchart2 is python based and has higher resolution by using TASKSTATS and PROC_EVENTS, worth having into Gentoo.

Reproducible: Always

Steps to Reproduce:
Comment 1 Gustavo Sverzut Barbieri 2010-11-16 02:00:02 UTC
Created attachment 254457 [details]
app-benchmarks/bootchart2-0.12.4.ebuild

New ebuild
Comment 2 Bruno 'brubru' Tarquini 2010-11-28 20:17:31 UTC
Some additions:

- CONFIG_TASK_DELAY_ACCT=y

seems needed in the kernel, otherwise, processes have no duration recorded and they are pruned from the chart.

- bootchart-collector doesn't work with CFLAGS optimisation -O* >= 2:

*** glibc detected *** ./bootchart-collector: double free or corruption (top): 0x0830f008 ***
======= Backtrace: =========
/lib/libc.so.6(+0x6b6d1)[0xb77936d1]
/lib/libc.so.6(+0x6cf38)[0xb7794f38]
/lib/libc.so.6(cfree+0x6d)[0xb779803d]
./bootchart-collector[0x804d786]
./bootchart-collector[0x804aa1c]
/lib/libc.so.6(__libc_start_main+0xe6)[0xb773ebb6]
./bootchart-collector[0x80497d1]


Portage 2.1.8.3 (default/linux/x86/10.0/desktop, gcc-4.4.4, glibc-2.11.2-r3, 2.6.35-gentoo-r12 i686)
=================================================================
System uname: Linux-2.6.35-gentoo-r12-i686-AMD_Athlon-tm-_XP_2800+-with-gentoo-2.0.1
Timestamp of tree: Fri, 26 Nov 2010 16:45:01 +0000
distcc 3.1 i686-pc-linux-gnu [disabled]
ccache version 2.4 [enabled]
app-shells/bash:     4.1_p7
dev-java/java-config: 2.1.11-r1
dev-lang/python:     2.6.5-r3
dev-util/ccache:     2.4-r7
dev-util/cmake:      2.8.1-r2
sys-apps/baselayout: 2.0.1
sys-apps/openrc:     0.6.5
sys-apps/sandbox:    2.3-r1
sys-devel/autoconf:  2.13, 2.65-r1
sys-devel/automake:  1.4_p6-r1, 1.5-r1, 1.7.9-r2, 1.9.6-r3, 1.10.3, 1.11.1
sys-devel/binutils:  2.20.1-r1
sys-devel/gcc:       4.4.4-r2
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.10
sys-devel/make:      3.81-r2
virtual/os-headers:  2.6.30-r1
ACCEPT_KEYWORDS="x86"
ACCEPT_LICENSE="* -@EULA"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-march=athlon-xp -pipe -O2 -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/X11/xkb /usr/share/config"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/splash /etc/terminfo"
CXXFLAGS="-march=athlon-xp -pipe -O2 -fomit-frame-pointer"
DISTDIR="/var/pkg/distfiles"
FEATURES="assume-digests ccache distlocks fixpackages news parallel-fetch protect-owned sandbox sfperms strict unmerge-logs unmerge-orphans userfetch"
GENTOO_MIRRORS="http://rsync4.fr.gentoo.org/gentoo"
LANG="fr_FR.UTF-8"
LC_ALL="fr_FR.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="fr fr_FR"
MAKEOPTS="-j2"
PKGDIR="/var/pkg/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/var/pkg/repos/gentoo"
PORTDIR_OVERLAY="/var/pkg/repos/local"
SYNC="rsync://rsync4.fr.gentoo.org/gentoo-portage"
USE="3dnow 3dnowext X a52 aac acpi alsa audiofile avahi bash-completion bluetooth branding bzip2 cairo cdr cli consolekit cracklib crypt cxx dbus dri dts dvd emboss encode exif fam ffmpeg firefox flac fortran gdbm gif glitz gpm gstreamer gtk hal iconv java joystick jpeg lcms libnotify lirc lm_sensors lzo mad matroska mikmod mmx mmxext mng modules mp3 mp4 mpeg mudflap musepack ncurses nls nptl nptlonly nsplugin nvidia ogg opengl openmp pam pango pcre pdf png ppds pppd python qt3support rar readline realmedia rtsp samba sdl session spell sqlite sqlite3 sse ssl startup-notification svg sysfs tcpd theora tiff truetype unicode usb v4l v4l2 vorbis wma x264 x86 xcb xml xorg xulrunner xv xvid zeroconf zlib zvbi" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="fr fr_FR" LIRC_DEVICES="serial" PHP_TARGETS="php5-2" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="nvidia nv nouveau vesa v4l none" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" 
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 3 Gustavo Sverzut Barbieri 2010-11-29 17:31:55 UTC
Created attachment 255851 [details]
new version with TASK_DELAY_ACCT check

new version that warns if there is no CONFIG_TASK_DELAY_ACCT in the kernel config.
Comment 4 Gustavo Sverzut Barbieri 2010-11-29 17:33:36 UTC
New ebuild attached, I do not get the same segv on my machine (amd64, gcc 4.4.5) with -O2. Anyway I believe this is a problem to be reported to upstream and have it fixed there.

Comment 5 Xake 2011-01-25 13:09:05 UTC
You may want to improve the handling of python code, currently pybootchartgui included is non working at least on my system.
Comment 6 Lucian Muresan 2011-02-03 01:41:07 UTC
Created attachment 261388 [details]
enhanced ebuild, also for 0.12.6

- collides legacy app-benchmarks/bootchart as they cannot be installed simultaneously;
- inherits multilib and python eclassess in order to conveniently fix lib and python paths;
- corrects the version in the Makefile (0.12.6 for example still has 0.12.6, so it uses ${PV} for non-9999;
- installs systemd unit files shipped with the archive if USE="systemd" (in which case it also RDEPENDs on systemd;
- added missing dev-python/pycairo dependency and svg USE flag

The 9999 really works for me, 0.12.6 builds fine, but bootchart-collector segfaults, so 9999 might be a better choice now
Comment 7 Xake 2011-02-03 22:04:23 UTC
(In reply to comment #6)


I see a lot of unnecessary seds here, better you specify them on the emake-line with for example PY_LIBDIR and so on I say.
I think I should try to push something like "LIBDIR ?= /lib" and "PREFIX ?= /usr" upstream, so we can set that too withut seds.
Comment 8 Xake 2011-02-06 15:18:21 UTC
Created attachment 261647 [details, diff]
use variable instead of hardcoded /lib/bootchart/bootchart-collector
Comment 9 Xake 2011-02-06 15:19:20 UTC
Created attachment 261648 [details, diff]
second patch, making LIBDIR changeable

@Lucian

How does these looks? Should I push them upstream, and we might work on that CUSTOM_POST_CMD in an additional patch?
Comment 10 Lucian Muresan 2011-02-07 14:11:56 UTC
@Xake:
As far a I can read it in bugzilla (cannot ssh to my htpc where I did the patching right now) they look good, so please go for it pushing. And yes, just peel the CUSTOM_POST_CMD patch off the patch from my email if you do not have other objections to it and make it a third separate patch. Thanks :-)
Comment 11 Xake 2011-02-10 18:11:17 UTC
@lucian

the patches are supposed to be merged upstream now, would you care to update the ebuild?
Comment 12 Lucian Muresan 2011-02-10 21:31:41 UTC
Created attachment 262087 [details]
updated ebuild after upstream integration of the 2 patches above

@Xake:

Had to introduce the src_compile phase now to properly get LIBDIR sed by the Makefile in /sbin/bootchartd
Comment 13 Lucian Muresan 2011-02-10 21:34:50 UTC
Created attachment 262089 [details, diff]
adds CUSTOM_POST_CMD which is executed after data collection and rendering

@Xake:

So this one would be still left, what do you think of it? Anyway, my last version of the ebuild wants this, too.
Comment 14 Xake 2011-02-10 21:49:22 UTC
(In reply to comment #13)
> @Xake:
> 
> So this one would be still left, what do you think of it? Anyway, my last
> version of the ebuild wants this, too.
> 

I can send it upstream with git like I did the last patches?
I think it looks nice, and now that I read the full patch in its own context the most questions I had had already been answered. 
Comment 15 Lucian Muresan 2011-02-11 00:06:49 UTC
(In reply to comment #14)
> I can send it upstream with git like I did the last patches?

Yes, please do so if it's ok. I'll then obsolete it here in the bugtracker, maybe you should already do that yourself with your patches...
Comment 16 Xake 2011-02-27 09:17:52 UTC
(In reply to comment #15)
> (In reply to comment #14)
> > I can send it upstream with git like I did the last patches?
> 
> Yes, please do so if it's ok. I'll then obsolete it here in the bugtracker,
> maybe you should already do that yourself with your patches...
> 

Merged upstream, sorry for the time it took. I got side-tracked.

Now the points left to take care of before I would call this "ready" are mostly two things:
1. bootchart fails to unmount /lib/bootchart/tmpfs*, which is something we have to fix in the code (mostly this is bootchart-collector mount ing the directories multiple times, and then tries to unmount it while it still runs inside of it).
2. a initscript that essentially does "grep -q "rdinit=/sbin/bootchartd" /proc/kernelcmd"&& ( /sbin/bootchartd wait_boot && /sbin/bootchartd stop )" for those people who runs dracut and integrates bootchart2 into it.
Comment 17 Lucian Muresan 2011-03-02 08:31:23 UTC
Created attachment 264331 [details]
init script to start collector without initrd

@Xake:

this init script should start the collector as early as possible if it wasn't started by a dracut generated initrd, did not yet test it like the other one I'll be posting right after.
Comment 18 Lucian Muresan 2011-03-02 08:38:20 UTC
Created attachment 264333 [details]
init script to stop the collector if started from initrd

@Xake:

this init script works for me when booting just with openrc and no systemd at all but with a dracut generated initrd (if I understood the code right, when starting with the other script, without initrd, bootchartd itself should take care of this?)
Comment 19 Lucian Muresan 2011-03-02 08:39:26 UTC
Created attachment 264335 [details]
bootchartd help message

fix the help message printed by running plain bootchartd
Comment 20 Lucian Muresan 2011-03-02 08:40:48 UTC
Created attachment 264337 [details]
updated ebuild

updated ebuild, obsoletes old version of ebuild and old CUSTOM_POST_CMD patch
Comment 21 Xake 2011-03-02 09:09:59 UTC
(In reply to comment #17)
> Created an attachment (id=264331) [details]
> init script to start collector without initrd
> 
> @Xake:
> 
> this init script should start the collector as early as possible if it wasn't
> started by a dracut generated initrd, did not yet test it like the other one
> I'll be posting right after.
> 

I would call this unnecessary.
It is better to use {rd,}init to get as much of the boot charted as possible, and not just from what point baselayout manages to start it (most often a bit after udev-related stuff).
Comment 22 Xake 2011-03-02 09:16:47 UTC
(In reply to comment #18)
> Created an attachment (id=264333) [details]
> init script to stop the collector if started from initrd
> 
> @Xake:
> 
> this init script works for me when booting just with openrc and no systemd at
> all but with a dracut generated initrd (if I understood the code right, when
> starting with the other script, without initrd, bootchartd itself should take
> care of this?)
> 

If started with init, then bootchartd handles it self, yes.
If started from ramdisk, then this is needed as any other routine is hard to get to survive the switch_root.
However, this script needs some rework.
First, this script only needs localmount (mostly to get it to start in a sane environment) since "bootchartd wait" takes care to see that bootchart --dump does not run until after the boot is completed.
Comment 23 Xake 2011-03-02 09:36:01 UTC
Created attachment 264341 [details]
initscript for bootchart

This script just schedules the termination of the background collector.

As "bootchartd wait" takes care to see that "bootchart-collector --dump" does not run before any of the "wait for"-applications are run there is no need to have any special deps that may break the dependency layout. I ask myself if there even need to be any deps...
Comment 24 Xake 2011-03-02 09:38:27 UTC
(In reply to comment #23)
> Created an attachment (id=264341) [details]
> initscript for bootchart
> 
> This script just schedules the termination of the background collector.
> 

If we want to be fancy, we may adjust it to look for any bootchartd in kernelcmd, and print a warning that this script does not start bootchart, just stops it and that it should be added to their kernelcmd.
Comment 25 Lucian Muresan 2011-03-02 10:44:21 UTC
Created attachment 264345 [details]
updated init script

@Xake: you're of course right with all of the above, so let's also get a bit fancy in that script
Comment 26 Lucian Muresan 2011-03-02 10:45:39 UTC
Created attachment 264347 [details]
updated ebuild, added ramdisk hint also in postinst message

added also a hint about the ramdisk in the postinst message
Comment 27 Lucian Muresan 2011-03-02 10:51:06 UTC
Hmm, there still is a it of inconsistency about the initscript grepping exactly for a kerenl command line suitable for a dracut-generated ramdisk, but the ebuild postinst message suggests a kernel command line "init=..." and not "rdinit=...". Perhaps this will settle down if genkernel eventually switches to using dracut internally as aidecoe said.
Comment 28 Xake 2011-03-02 11:36:47 UTC
(In reply to comment #27)
> Hmm, there still is a it of inconsistency about the initscript grepping exactly
> for a kerenl command line suitable for a dracut-generated ramdisk, but the
> ebuild postinst message suggests a kernel command line "init=..." and not
> "rdinit=...". Perhaps this will settle down if genkernel eventually switches to
> using dracut internally as aidecoe said.
> 

I think the message should be as following:
<elog>
You need to start bootchart as your init, but depending on your configuration you can do this in various ways:
* No initramfs/no charting of initramfs: add "initcall_debug printk.time=y init=/sbin/bootchartd" to your kernel command line
* dracut initramfs with bootchart module: add "initcall_debug printk.time=y rdinit=/sbin/bootchartd" to your kernel command line

If you use a genkernel generated initramfs then you should use real_init instead of init.
I you use dracut or a custom initramfs with a bootchart module, then you need to add the bootchart2 initscript to your default runlevel to make sure bootchart2 terminates and write its information to /var/log/bootchart.tgz correctly.
</elog>
Comment 29 Henry Gebhardt 2011-05-30 01:35:42 UTC
Created attachment 275053 [details]
updated ebuild, for version 0.14.0

This is an updated ebuild, using the init script in this bug report, and the patch about bootchart_init that I will attach in a minute.

Main changes:

- Use systemd eclass. It is up to the eclass to decide whether we get a use flag or not.

- Remove multilib, because /lib is hardcoded in collector/common.h, and no libraries are installed.

- Remove unneeded phase functions (called automatically).

- "usagehelp" patch is no longer needed.
Comment 30 Henry Gebhardt 2011-05-30 01:39:23 UTC
Created attachment 275055 [details, diff]
Look for bootchart_init in the environment

Kernel command line arguments of the form "foo=bar" (see bootparam(7)) are passed as environment variables, so look there for bootchart_init. I need this to use bootchart (without initrd).

I submitted this upstream to the main author (Michael Meeks) but haven't had a reply yet.
Comment 31 Justin Lecher (RETIRED) gentoo-dev 2012-04-02 07:20:01 UTC
Hi guys, I added that one. Thanks for the contributions. In case you see things which need to be enhanced, please open new bugs so that I can fix it.


+*bootchart2-0.14.2 (02 Apr 2012)
+
+  02 Apr 2012; Justin Lecher <jlec@gentoo.org> +bootchart2-0.14.2.ebuild,
+  +metadata.xml:
+  New addition, ebuild after submission by Gustavo Sverzut Barbieri, Lucian
+  Muresan & Henry Gebhardt; #345695
+