From 618a8a634b37da88b67a49beec7282634bff3efe Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Thu, 22 Oct 2009 14:37:05 -0700 Subject: Enable Kbuild-like quiet builds This enables much cleaner build output from automake. To re-enable the verbose commands, pass --disable-silent-rules to configure, or use V=1 at make time. * configure.ac: Enable AM_SILENT_RULES by default. --- grapher/Makefile.in | 78 ++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 53 insertions(+), 25 deletions(-) (limited to 'grapher') diff --git a/grapher/Makefile.in b/grapher/Makefile.in index 16f78dc9..0c40336d 100644 --- a/grapher/Makefile.in +++ b/grapher/Makefile.in @@ -65,11 +65,26 @@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/depcomp am__depfiles_maybe = depfiles am__mv = mv -f +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +AM_V_CXX = $(am__v_CXX_$(V)) +am__v_CXX_ = $(am__v_CXX_$(AM_DEFAULT_VERBOSITY)) +am__v_CXX_0 = @echo " CXX " $@; +AM_V_at = $(am__v_at_$(V)) +am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) +am__v_at_0 = @ CXXLD = $(CXX) CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ +AM_V_CXXLD = $(am__v_CXXLD_$(V)) +am__v_CXXLD_ = $(am__v_CXXLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CXXLD_0 = @echo " CXXLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(stapgraph_SOURCES) DIST_SOURCES = $(am__stapgraph_SOURCES_DIST) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; @@ -103,6 +118,7 @@ CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ +AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ @@ -306,7 +322,7 @@ clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) stapgraph$(EXEEXT): $(stapgraph_OBJECTS) $(stapgraph_DEPENDENCIES) @rm -f stapgraph$(EXEEXT) - $(stapgraph_LINK) $(stapgraph_OBJECTS) $(stapgraph_LDADD) $(LIBS) + $(AM_V_CXXLD)$(stapgraph_LINK) $(stapgraph_OBJECTS) $(stapgraph_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) @@ -321,85 +337,97 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stapgraph-grapher.Po@am__quote@ .cxx.o: -@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cxx.obj: -@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` stapgraph-grapher.o: grapher.cxx -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(stapgraph_CPPFLAGS) $(CPPFLAGS) $(stapgraph_CXXFLAGS) $(CXXFLAGS) -MT stapgraph-grapher.o -MD -MP -MF $(DEPDIR)/stapgraph-grapher.Tpo -c -o stapgraph-grapher.o `test -f 'grapher.cxx' || echo '$(srcdir)/'`grapher.cxx -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/stapgraph-grapher.Tpo $(DEPDIR)/stapgraph-grapher.Po +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(stapgraph_CPPFLAGS) $(CPPFLAGS) $(stapgraph_CXXFLAGS) $(CXXFLAGS) -MT stapgraph-grapher.o -MD -MP -MF $(DEPDIR)/stapgraph-grapher.Tpo -c -o stapgraph-grapher.o `test -f 'grapher.cxx' || echo '$(srcdir)/'`grapher.cxx +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/stapgraph-grapher.Tpo $(DEPDIR)/stapgraph-grapher.Po +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='grapher.cxx' object='stapgraph-grapher.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(stapgraph_CPPFLAGS) $(CPPFLAGS) $(stapgraph_CXXFLAGS) $(CXXFLAGS) -c -o stapgraph-grapher.o `test -f 'grapher.cxx' || echo '$(srcdir)/'`grapher.cxx stapgraph-grapher.obj: grapher.cxx -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(stapgraph_CPPFLAGS) $(CPPFLAGS) $(stapgraph_CXXFLAGS) $(CXXFLAGS) -MT stapgraph-grapher.obj -MD -MP -MF $(DEPDIR)/stapgraph-grapher.Tpo -c -o stapgraph-grapher.obj `if test -f 'grapher.cxx'; then $(CYGPATH_W) 'grapher.cxx'; else $(CYGPATH_W) '$(srcdir)/grapher.cxx'; fi` -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/stapgraph-grapher.Tpo $(DEPDIR)/stapgraph-grapher.Po +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(stapgraph_CPPFLAGS) $(CPPFLAGS) $(stapgraph_CXXFLAGS) $(CXXFLAGS) -MT stapgraph-grapher.obj -MD -MP -MF $(DEPDIR)/stapgraph-grapher.Tpo -c -o stapgraph-grapher.obj `if test -f 'grapher.cxx'; then $(CYGPATH_W) 'grapher.cxx'; else $(CYGPATH_W) '$(srcdir)/grapher.cxx'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/stapgraph-grapher.Tpo $(DEPDIR)/stapgraph-grapher.Po +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='grapher.cxx' object='stapgraph-grapher.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(stapgraph_CPPFLAGS) $(CPPFLAGS) $(stapgraph_CXXFLAGS) $(CXXFLAGS) -c -o stapgraph-grapher.obj `if test -f 'grapher.cxx'; then $(CYGPATH_W) 'grapher.cxx'; else $(CYGPATH_W) '$(srcdir)/grapher.cxx'; fi` stapgraph-StapParser.o: StapParser.cxx -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(stapgraph_CPPFLAGS) $(CPPFLAGS) $(stapgraph_CXXFLAGS) $(CXXFLAGS) -MT stapgraph-StapParser.o -MD -MP -MF $(DEPDIR)/stapgraph-StapParser.Tpo -c -o stapgraph-StapParser.o `test -f 'StapParser.cxx' || echo '$(srcdir)/'`StapParser.cxx -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/stapgraph-StapParser.Tpo $(DEPDIR)/stapgraph-StapParser.Po +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(stapgraph_CPPFLAGS) $(CPPFLAGS) $(stapgraph_CXXFLAGS) $(CXXFLAGS) -MT stapgraph-StapParser.o -MD -MP -MF $(DEPDIR)/stapgraph-StapParser.Tpo -c -o stapgraph-StapParser.o `test -f 'StapParser.cxx' || echo '$(srcdir)/'`StapParser.cxx +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/stapgraph-StapParser.Tpo $(DEPDIR)/stapgraph-StapParser.Po +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='StapParser.cxx' object='stapgraph-StapParser.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(stapgraph_CPPFLAGS) $(CPPFLAGS) $(stapgraph_CXXFLAGS) $(CXXFLAGS) -c -o stapgraph-StapParser.o `test -f 'StapParser.cxx' || echo '$(srcdir)/'`StapParser.cxx stapgraph-StapParser.obj: StapParser.cxx -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(stapgraph_CPPFLAGS) $(CPPFLAGS) $(stapgraph_CXXFLAGS) $(CXXFLAGS) -MT stapgraph-StapParser.obj -MD -MP -MF $(DEPDIR)/stapgraph-StapParser.Tpo -c -o stapgraph-StapParser.obj `if test -f 'StapParser.cxx'; then $(CYGPATH_W) 'StapParser.cxx'; else $(CYGPATH_W) '$(srcdir)/StapParser.cxx'; fi` -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/stapgraph-StapParser.Tpo $(DEPDIR)/stapgraph-StapParser.Po +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(stapgraph_CPPFLAGS) $(CPPFLAGS) $(stapgraph_CXXFLAGS) $(CXXFLAGS) -MT stapgraph-StapParser.obj -MD -MP -MF $(DEPDIR)/stapgraph-StapParser.Tpo -c -o stapgraph-StapParser.obj `if test -f 'StapParser.cxx'; then $(CYGPATH_W) 'StapParser.cxx'; else $(CYGPATH_W) '$(srcdir)/StapParser.cxx'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/stapgraph-StapParser.Tpo $(DEPDIR)/stapgraph-StapParser.Po +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='StapParser.cxx' object='stapgraph-StapParser.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(stapgraph_CPPFLAGS) $(CPPFLAGS) $(stapgraph_CXXFLAGS) $(CXXFLAGS) -c -o stapgraph-StapParser.obj `if test -f 'StapParser.cxx'; then $(CYGPATH_W) 'StapParser.cxx'; else $(CYGPATH_W) '$(srcdir)/StapParser.cxx'; fi` stapgraph-Graph.o: Graph.cxx -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(stapgraph_CPPFLAGS) $(CPPFLAGS) $(stapgraph_CXXFLAGS) $(CXXFLAGS) -MT stapgraph-Graph.o -MD -MP -MF $(DEPDIR)/stapgraph-Graph.Tpo -c -o stapgraph-Graph.o `test -f 'Graph.cxx' || echo '$(srcdir)/'`Graph.cxx -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/stapgraph-Graph.Tpo $(DEPDIR)/stapgraph-Graph.Po +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(stapgraph_CPPFLAGS) $(CPPFLAGS) $(stapgraph_CXXFLAGS) $(CXXFLAGS) -MT stapgraph-Graph.o -MD -MP -MF $(DEPDIR)/stapgraph-Graph.Tpo -c -o stapgraph-Graph.o `test -f 'Graph.cxx' || echo '$(srcdir)/'`Graph.cxx +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/stapgraph-Graph.Tpo $(DEPDIR)/stapgraph-Graph.Po +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Graph.cxx' object='stapgraph-Graph.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(stapgraph_CPPFLAGS) $(CPPFLAGS) $(stapgraph_CXXFLAGS) $(CXXFLAGS) -c -o stapgraph-Graph.o `test -f 'Graph.cxx' || echo '$(srcdir)/'`Graph.cxx stapgraph-Graph.obj: Graph.cxx -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(stapgraph_CPPFLAGS) $(CPPFLAGS) $(stapgraph_CXXFLAGS) $(CXXFLAGS) -MT stapgraph-Graph.obj -MD -MP -MF $(DEPDIR)/stapgraph-Graph.Tpo -c -o stapgraph-Graph.obj `if test -f 'Graph.cxx'; then $(CYGPATH_W) 'Graph.cxx'; else $(CYGPATH_W) '$(srcdir)/Graph.cxx'; fi` -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/stapgraph-Graph.Tpo $(DEPDIR)/stapgraph-Graph.Po +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(stapgraph_CPPFLAGS) $(CPPFLAGS) $(stapgraph_CXXFLAGS) $(CXXFLAGS) -MT stapgraph-Graph.obj -MD -MP -MF $(DEPDIR)/stapgraph-Graph.Tpo -c -o stapgraph-Graph.obj `if test -f 'Graph.cxx'; then $(CYGPATH_W) 'Graph.cxx'; else $(CYGPATH_W) '$(srcdir)/Graph.cxx'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/stapgraph-Graph.Tpo $(DEPDIR)/stapgraph-Graph.Po +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Graph.cxx' object='stapgraph-Graph.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(stapgraph_CPPFLAGS) $(CPPFLAGS) $(stapgraph_CXXFLAGS) $(CXXFLAGS) -c -o stapgraph-Graph.obj `if test -f 'Graph.cxx'; then $(CYGPATH_W) 'Graph.cxx'; else $(CYGPATH_W) '$(srcdir)/Graph.cxx'; fi` stapgraph-GraphWidget.o: GraphWidget.cxx -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(stapgraph_CPPFLAGS) $(CPPFLAGS) $(stapgraph_CXXFLAGS) $(CXXFLAGS) -MT stapgraph-GraphWidget.o -MD -MP -MF $(DEPDIR)/stapgraph-GraphWidget.Tpo -c -o stapgraph-GraphWidget.o `test -f 'GraphWidget.cxx' || echo '$(srcdir)/'`GraphWidget.cxx -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/stapgraph-GraphWidget.Tpo $(DEPDIR)/stapgraph-GraphWidget.Po +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(stapgraph_CPPFLAGS) $(CPPFLAGS) $(stapgraph_CXXFLAGS) $(CXXFLAGS) -MT stapgraph-GraphWidget.o -MD -MP -MF $(DEPDIR)/stapgraph-GraphWidget.Tpo -c -o stapgraph-GraphWidget.o `test -f 'GraphWidget.cxx' || echo '$(srcdir)/'`GraphWidget.cxx +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/stapgraph-GraphWidget.Tpo $(DEPDIR)/stapgraph-GraphWidget.Po +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='GraphWidget.cxx' object='stapgraph-GraphWidget.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(stapgraph_CPPFLAGS) $(CPPFLAGS) $(stapgraph_CXXFLAGS) $(CXXFLAGS) -c -o stapgraph-GraphWidget.o `test -f 'GraphWidget.cxx' || echo '$(srcdir)/'`GraphWidget.cxx stapgraph-GraphWidget.obj: GraphWidget.cxx -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(stapgraph_CPPFLAGS) $(CPPFLAGS) $(stapgraph_CXXFLAGS) $(CXXFLAGS) -MT stapgraph-GraphWidget.obj -MD -MP -MF $(DEPDIR)/stapgraph-GraphWidget.Tpo -c -o stapgraph-GraphWidget.obj `if test -f 'GraphWidget.cxx'; then $(CYGPATH_W) 'GraphWidget.cxx'; else $(CYGPATH_W) '$(srcdir)/GraphWidget.cxx'; fi` -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/stapgraph-GraphWidget.Tpo $(DEPDIR)/stapgraph-GraphWidget.Po +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(stapgraph_CPPFLAGS) $(CPPFLAGS) $(stapgraph_CXXFLAGS) $(CXXFLAGS) -MT stapgraph-GraphWidget.obj -MD -MP -MF $(DEPDIR)/stapgraph-GraphWidget.Tpo -c -o stapgraph-GraphWidget.obj `if test -f 'GraphWidget.cxx'; then $(CYGPATH_W) 'GraphWidget.cxx'; else $(CYGPATH_W) '$(srcdir)/GraphWidget.cxx'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/stapgraph-GraphWidget.Tpo $(DEPDIR)/stapgraph-GraphWidget.Po +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='GraphWidget.cxx' object='stapgraph-GraphWidget.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(stapgraph_CPPFLAGS) $(CPPFLAGS) $(stapgraph_CXXFLAGS) $(CXXFLAGS) -c -o stapgraph-GraphWidget.obj `if test -f 'GraphWidget.cxx'; then $(CYGPATH_W) 'GraphWidget.cxx'; else $(CYGPATH_W) '$(srcdir)/GraphWidget.cxx'; fi` stapgraph-CairoWidget.o: CairoWidget.cxx -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(stapgraph_CPPFLAGS) $(CPPFLAGS) $(stapgraph_CXXFLAGS) $(CXXFLAGS) -MT stapgraph-CairoWidget.o -MD -MP -MF $(DEPDIR)/stapgraph-CairoWidget.Tpo -c -o stapgraph-CairoWidget.o `test -f 'CairoWidget.cxx' || echo '$(srcdir)/'`CairoWidget.cxx -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/stapgraph-CairoWidget.Tpo $(DEPDIR)/stapgraph-CairoWidget.Po +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(stapgraph_CPPFLAGS) $(CPPFLAGS) $(stapgraph_CXXFLAGS) $(CXXFLAGS) -MT stapgraph-CairoWidget.o -MD -MP -MF $(DEPDIR)/stapgraph-CairoWidget.Tpo -c -o stapgraph-CairoWidget.o `test -f 'CairoWidget.cxx' || echo '$(srcdir)/'`CairoWidget.cxx +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/stapgraph-CairoWidget.Tpo $(DEPDIR)/stapgraph-CairoWidget.Po +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='CairoWidget.cxx' object='stapgraph-CairoWidget.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(stapgraph_CPPFLAGS) $(CPPFLAGS) $(stapgraph_CXXFLAGS) $(CXXFLAGS) -c -o stapgraph-CairoWidget.o `test -f 'CairoWidget.cxx' || echo '$(srcdir)/'`CairoWidget.cxx stapgraph-CairoWidget.obj: CairoWidget.cxx -@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(stapgraph_CPPFLAGS) $(CPPFLAGS) $(stapgraph_CXXFLAGS) $(CXXFLAGS) -MT stapgraph-CairoWidget.obj -MD -MP -MF $(DEPDIR)/stapgraph-CairoWidget.Tpo -c -o stapgraph-CairoWidget.obj `if test -f 'CairoWidget.cxx'; then $(CYGPATH_W) 'CairoWidget.cxx'; else $(CYGPATH_W) '$(srcdir)/CairoWidget.cxx'; fi` -@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/stapgraph-CairoWidget.Tpo $(DEPDIR)/stapgraph-CairoWidget.Po +@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(stapgraph_CPPFLAGS) $(CPPFLAGS) $(stapgraph_CXXFLAGS) $(CXXFLAGS) -MT stapgraph-CairoWidget.obj -MD -MP -MF $(DEPDIR)/stapgraph-CairoWidget.Tpo -c -o stapgraph-CairoWidget.obj `if test -f 'CairoWidget.cxx'; then $(CYGPATH_W) 'CairoWidget.cxx'; else $(CYGPATH_W) '$(srcdir)/CairoWidget.cxx'; fi` +@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/stapgraph-CairoWidget.Tpo $(DEPDIR)/stapgraph-CairoWidget.Po +@am__fastdepCXX_FALSE@ $(AM_V_CXX) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='CairoWidget.cxx' object='stapgraph-CairoWidget.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(stapgraph_CPPFLAGS) $(CPPFLAGS) $(stapgraph_CXXFLAGS) $(CXXFLAGS) -c -o stapgraph-CairoWidget.obj `if test -f 'CairoWidget.cxx'; then $(CYGPATH_W) 'CairoWidget.cxx'; else $(CYGPATH_W) '$(srcdir)/CairoWidget.cxx'; fi` -- cgit From 6fb95a63ecfa32b1524790ee42695f19773f2174 Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Tue, 20 Oct 2009 22:14:00 +0200 Subject: Change stap parser to use an input file descriptor other than stdin * grapher/StapParser.hxx (_inFd, getInFd, setInFd): new member and fuctions * grapher/StapParser.cxx (ioCallback): Use _inFd variable instead of stdin. * grapher/grapher.cxx (StapLauncher::launch): Don't read input from stap on stdin; use the the read end of the pipe. --- grapher/StapParser.cxx | 2 +- grapher/StapParser.hxx | 8 +++++++- grapher/grapher.cxx | 21 +++++++-------------- 3 files changed, 15 insertions(+), 16 deletions(-) (limited to 'grapher') diff --git a/grapher/StapParser.cxx b/grapher/StapParser.cxx index 9bb9b9c9..eea85006 100644 --- a/grapher/StapParser.cxx +++ b/grapher/StapParser.cxx @@ -70,7 +70,7 @@ vector commaSplit(const boost::sub_range& range) return true; char buf[256]; ssize_t bytes_read = 0; - bytes_read = read(STDIN_FILENO, buf, sizeof(buf) - 1); + bytes_read = read(_inFd, buf, sizeof(buf) - 1); if (bytes_read <= 0) { _win.hide(); diff --git a/grapher/StapParser.hxx b/grapher/StapParser.hxx index f4f6bdef..eeebed63 100644 --- a/grapher/StapParser.hxx +++ b/grapher/StapParser.hxx @@ -13,14 +13,20 @@ class StapParser Gtk::Window& _win; GraphWidget& _widget; int _errFd; + int _inFd; public: StapParser(Gtk::Window& win, - GraphWidget& widget) : _win(win), _widget(widget), _errFd(-1) {} + GraphWidget& widget) : _win(win), _widget(widget), _errFd(-1), + _inFd(-1) + { + } void parseData(std::tr1::shared_ptr gdata, double time, const std::string& dataString); bool ioCallback(Glib::IOCondition ioCondition); bool errIoCallback(Glib::IOCondition ioCondition); int getErrFd() { return _errFd; } void setErrFd(int fd) { _errFd = fd; } + int getInFd() { return _inFd; } + void setInFd(int fd) { _inFd = fd; } }; } diff --git a/grapher/grapher.cxx b/grapher/grapher.cxx index 429d0537..398b35f1 100644 --- a/grapher/grapher.cxx +++ b/grapher/grapher.cxx @@ -257,8 +257,6 @@ protected: int StapLauncher::launch() { - int stapErrFd = -1; - if (pipe(&signalPipe[0]) < 0) { std::perror("pipe"); @@ -286,9 +284,6 @@ int StapLauncher::launch() } else if (_childPid) { - dup2(pipefd[0], STDIN_FILENO); - stapErrFd = pipefd[2]; - close(pipefd[0]); close(pipefd[1]); close(pipefd[3]); } @@ -318,14 +313,12 @@ int StapLauncher::launch() } _exit(1); } - if (stapErrFd >= 0) - { - _stapParser->setErrFd(stapErrFd); - Glib::signal_io().connect(sigc::mem_fun(*_stapParser, - &StapParser::errIoCallback), - stapErrFd, - Glib::IO_IN); - } + _stapParser->setErrFd(pipefd[2]); + _stapParser->setInFd(pipefd[0]); + Glib::signal_io().connect(sigc::mem_fun(*_stapParser, + &StapParser::errIoCallback), + pipefd[2], + Glib::IO_IN); setSigfd(signalPipe[0]); if (signalPipe[0] >= 0) { @@ -335,7 +328,7 @@ int StapLauncher::launch() } Glib::signal_io().connect(sigc::mem_fun(*_stapParser, &StapParser::ioCallback), - STDIN_FILENO, + pipefd[0], Glib::IO_IN | Glib::IO_HUP); return _childPid; } -- cgit From 4bf8ba6e4fc0a950301e5debedababa834ea0d10 Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Wed, 21 Oct 2009 17:05:59 +0200 Subject: More refactoring for multiple stap processes. * grapher/StapParser.hxx (StapParser): Change _win and _widget from references to pointers. * grapher/StapParser.cxx (ioCallback): Ditto. * grapher/grapher.cxx (StapLauncher, GraphicalStapLauncher): Rewrite to make GraphicalStapLauncher a derived class of StapLauncher. (main): Accept graphing data from stdin with a "-" argument. --- grapher/StapParser.cxx | 10 +- grapher/StapParser.hxx | 8 +- grapher/grapher.cxx | 317 +++++++++++++++++++++++++------------------------ 3 files changed, 173 insertions(+), 162 deletions(-) (limited to 'grapher') diff --git a/grapher/StapParser.cxx b/grapher/StapParser.cxx index eea85006..249836d3 100644 --- a/grapher/StapParser.cxx +++ b/grapher/StapParser.cxx @@ -63,7 +63,7 @@ vector commaSplit(const boost::sub_range& range) using namespace boost; if (ioCondition & Glib::IO_HUP) { - _win.hide(); + _win->hide(); return true; } if ((ioCondition & Glib::IO_IN) == 0) @@ -73,7 +73,7 @@ vector commaSplit(const boost::sub_range& range) bytes_read = read(_inFd, buf, sizeof(buf) - 1); if (bytes_read <= 0) { - _win.hide(); + _win->hide(); return true; } buf[bytes_read] = '\0'; @@ -108,7 +108,7 @@ vector commaSplit(const boost::sub_range& range) dataSet->color[2] = (hexColor & 0xff) / 255.0; dataSet->scale = scale; _dataSets.insert(std::make_pair(setName, dataSet)); - _widget.addGraphData(dataSet); + _widget->addGraphData(dataSet); } else if (style == "discreet") { @@ -120,7 +120,7 @@ vector commaSplit(const boost::sub_range& range) dataSet->color[2] = (hexColor & 0xff) / 255.0; dataSet->scale = scale; _dataSets.insert(std::make_pair(setName, dataSet)); - _widget.addGraphData(dataSet); + _widget->addGraphData(dataSet); } } else if ((found = find_first(dataString, "%CSV:"))) @@ -219,7 +219,7 @@ vector commaSplit(const boost::sub_range& range) bytes_read = read(_errFd, buf, sizeof(buf) - 1); if (bytes_read <= 0) { - _win.hide(); + _win->hide(); return true; } if (write(STDOUT_FILENO, buf, bytes_read) < 0) diff --git a/grapher/StapParser.hxx b/grapher/StapParser.hxx index eeebed63..40add9fd 100644 --- a/grapher/StapParser.hxx +++ b/grapher/StapParser.hxx @@ -10,13 +10,13 @@ class StapParser typedef std::map > DataMap; DataMap _dataSets; CSVData _csv; - Gtk::Window& _win; - GraphWidget& _widget; + Gtk::Window* _win; + GraphWidget* _widget; int _errFd; int _inFd; public: - StapParser(Gtk::Window& win, - GraphWidget& widget) : _win(win), _widget(widget), _errFd(-1), + StapParser(Gtk::Window* win, + GraphWidget* widget) : _win(win), _widget(widget), _errFd(-1), _inFd(-1) { } diff --git a/grapher/grapher.cxx b/grapher/grapher.cxx index 398b35f1..598f389b 100644 --- a/grapher/grapher.cxx +++ b/grapher/grapher.cxx @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -31,6 +32,20 @@ using namespace std; using namespace systemtap; +// magic for noticing that the child stap process has died. +int signalPipe[2] = {-1, -1}; + +extern "C" +{ + void handleChild(int signum, siginfo_t* info, void* context) + { + char buf[1]; + ssize_t err; + buf[0] = 1; + err = write(signalPipe[1], buf, 1); + } +} + // Waits for a gtk I/O signal, indicating that a child has died, then // performs an action @@ -63,143 +78,19 @@ private: int sigfd; }; -class StapLauncher; - -class GraphicalStapLauncher -{ -public: - GraphicalStapLauncher(StapLauncher* launcher); - bool runDialog(); - void onLaunch(); - void onLaunchCancel(); -private: - Glib::RefPtr _launchStapDialog; - Gtk::Window* _scriptWindow; - Gtk::FileChooserButton* _chooserButton; - Gtk::Entry* _stapArgEntry; - Gtk::Entry* _scriptArgEntry; - StapLauncher* _launcher; -}; - -class GrapherWindow : public Gtk::Window, public ChildDeathReader::Callback -{ -public: - GrapherWindow(); - virtual ~GrapherWindow() {} - Gtk::VBox m_Box; - Gtk::ScrolledWindow scrolled; - GraphWidget w; - void childDied(int pid); - void setGraphicalLauncher(GraphicalStapLauncher* launcher) - { - _graphicalLauncher = launcher; - } - GraphicalStapLauncher* getGraphicalLauncher() { return _graphicalLauncher; } -protected: - virtual void on_menu_file_quit(); - virtual void on_menu_script_start(); - void addGraph(); - // menu support - Glib::RefPtr m_refUIManager; - Glib::RefPtr m_refActionGroup; - GraphicalStapLauncher* _graphicalLauncher; - -}; - -GrapherWindow::GrapherWindow() -{ - set_title("systemtap grapher"); - add(m_Box); - - - //Create actions for menus and toolbars: - m_refActionGroup = Gtk::ActionGroup::create(); - //File menu: - m_refActionGroup->add(Gtk::Action::create("FileMenu", "File")); - m_refActionGroup->add(Gtk::Action::create("StartScript", "Start script"), - sigc::mem_fun(*this, - &GrapherWindow::on_menu_script_start)); - m_refActionGroup->add(Gtk::Action::create("AddGraph", "Add graph"), - sigc::mem_fun(*this, &GrapherWindow::addGraph)); - m_refActionGroup->add(Gtk::Action::create("FileQuit", Gtk::Stock::QUIT), - sigc::mem_fun(*this, - &GrapherWindow::on_menu_file_quit)); - m_refUIManager = Gtk::UIManager::create(); - m_refUIManager->insert_action_group(m_refActionGroup); - - add_accel_group(m_refUIManager->get_accel_group()); - //Layout the actions in a menubar and toolbar: - Glib::ustring ui_info = - "" - " " - " " - " " - " " - " " - " " - " " - ""; - try - { - m_refUIManager->add_ui_from_string(ui_info); - } - catch(const Glib::Error& ex) - { - std::cerr << "building menus failed: " << ex.what(); - } - Gtk::Widget* pMenubar = m_refUIManager->get_widget("/MenuBar"); - scrolled.add(w); - if(pMenubar) - m_Box.pack_start(*pMenubar, Gtk::PACK_SHRINK); - m_Box.pack_start(scrolled, Gtk::PACK_EXPAND_WIDGET); - scrolled.show(); - - show_all_children(); - -} - -void GrapherWindow::on_menu_file_quit() -{ - hide(); -} - -void GrapherWindow::on_menu_script_start() -{ - _graphicalLauncher->runDialog(); -} - -void GrapherWindow::childDied(int pid) -{ - hide(); -} - -// magic for noticing that the child stap process has died. -int signalPipe[2] = {-1, -1}; - -extern "C" -{ - void handleChild(int signum, siginfo_t* info, void* context) - { - char buf[1]; - ssize_t err; - buf[0] = 1; - err = write(signalPipe[1], buf, 1); - } -} - // Depending on how args are passed, either launch stap directly or // use the shell to parse arguments class StapLauncher : public ChildDeathReader { public: - StapLauncher() : _argv(0), _childPid(-1), _deathCallback(0), _stapParser(0) {} + StapLauncher() : _argv(0), _childPid(-1), _deathCallback(0) {} StapLauncher(char** argv) - : _argv(argv), _childPid(-1), _deathCallback(0), _stapParser(0) + : _argv(argv), _childPid(-1), _deathCallback(0) { } StapLauncher(const string& stapArgs, const string& script, const string& scriptArgs) - : _childPid(-1), _deathCallback(0), _stapParser(0) + : _childPid(-1), _deathCallback(0), _win(0), _widget(0) { setArgs(stapArgs, script, scriptArgs); } @@ -239,12 +130,19 @@ public: { _deathCallback = callback; } - void setStapParser(StapParser *parser) + void setWinParams(Gtk::Window* win, GraphWidget* widget) { - _stapParser = parser; + _win = win; + _widget = widget; } int launch(); void cleanUp(); + tr1::shared_ptr makeStapParser() + { + tr1::shared_ptr result(new StapParser(_win, _widget)); + _stapParsers.push_back(result); + return result; + } protected: char** _argv; string _stapArgs; @@ -252,7 +150,9 @@ protected: string _scriptArgs; int _childPid; ChildDeathReader::Callback* _deathCallback; - StapParser* _stapParser; + Gtk::Window* _win; + GraphWidget* _widget; + vector > _stapParsers; }; int StapLauncher::launch() @@ -313,9 +213,11 @@ int StapLauncher::launch() } _exit(1); } - _stapParser->setErrFd(pipefd[2]); - _stapParser->setInFd(pipefd[0]); - Glib::signal_io().connect(sigc::mem_fun(*_stapParser, + tr1::shared_ptr sp(new StapParser(_win, _widget)); + _stapParsers.push_back(sp); + sp->setErrFd(pipefd[2]); + sp->setInFd(pipefd[0]); + Glib::signal_io().connect(sigc::mem_fun(sp.get(), &StapParser::errIoCallback), pipefd[2], Glib::IO_IN); @@ -326,7 +228,7 @@ int StapLauncher::launch() &ChildDeathReader::ioCallback), signalPipe[0], Glib::IO_IN); } - Glib::signal_io().connect(sigc::mem_fun(*_stapParser, + Glib::signal_io().connect(sigc::mem_fun(sp.get(), &StapParser::ioCallback), pipefd[0], Glib::IO_IN | Glib::IO_HUP); @@ -347,34 +249,144 @@ void StapLauncher::cleanUp() } } -StapLauncher launcher; +class GraphicalStapLauncher : public StapLauncher +{ +public: + GraphicalStapLauncher(); + bool runDialog(); + void onLaunch(); + void onLaunchCancel(); +private: + Glib::RefPtr _launchStapDialog; + Gtk::Window* _scriptWindow; + Gtk::FileChooserButton* _chooserButton; + Gtk::Entry* _stapArgEntry; + Gtk::Entry* _scriptArgEntry; + StapLauncher* _launcher; +}; + +class GrapherWindow : public Gtk::Window, public ChildDeathReader::Callback +{ +public: + GrapherWindow(); + virtual ~GrapherWindow() {} + Gtk::VBox m_Box; + Gtk::ScrolledWindow scrolled; + GraphWidget w; + void childDied(int pid); + void setGraphicalLauncher(GraphicalStapLauncher* launcher) + { + _graphicalLauncher = launcher; + } + GraphicalStapLauncher* getGraphicalLauncher() { return _graphicalLauncher; } +protected: + virtual void on_menu_file_quit(); + virtual void on_menu_script_start(); + void addGraph(); + // menu support + Glib::RefPtr m_refUIManager; + Glib::RefPtr m_refActionGroup; + GraphicalStapLauncher* _graphicalLauncher; + +}; + +GrapherWindow::GrapherWindow() +{ + set_title("systemtap grapher"); + add(m_Box); + + + //Create actions for menus and toolbars: + m_refActionGroup = Gtk::ActionGroup::create(); + //File menu: + m_refActionGroup->add(Gtk::Action::create("FileMenu", "File")); + m_refActionGroup->add(Gtk::Action::create("StartScript", "Start script"), + sigc::mem_fun(*this, + &GrapherWindow::on_menu_script_start)); + m_refActionGroup->add(Gtk::Action::create("AddGraph", "Add graph"), + sigc::mem_fun(*this, &GrapherWindow::addGraph)); + m_refActionGroup->add(Gtk::Action::create("FileQuit", Gtk::Stock::QUIT), + sigc::mem_fun(*this, + &GrapherWindow::on_menu_file_quit)); + m_refUIManager = Gtk::UIManager::create(); + m_refUIManager->insert_action_group(m_refActionGroup); + + add_accel_group(m_refUIManager->get_accel_group()); + //Layout the actions in a menubar and toolbar: + Glib::ustring ui_info = + "" + " " + " " + " " + " " + " " + " " + " " + ""; + try + { + m_refUIManager->add_ui_from_string(ui_info); + } + catch(const Glib::Error& ex) + { + std::cerr << "building menus failed: " << ex.what(); + } + Gtk::Widget* pMenubar = m_refUIManager->get_widget("/MenuBar"); + scrolled.add(w); + if(pMenubar) + m_Box.pack_start(*pMenubar, Gtk::PACK_SHRINK); + m_Box.pack_start(scrolled, Gtk::PACK_EXPAND_WIDGET); + scrolled.show(); + + show_all_children(); + +} + +void GrapherWindow::on_menu_file_quit() +{ + hide(); +} + +void GrapherWindow::on_menu_script_start() +{ + _graphicalLauncher->runDialog(); +} + +void GrapherWindow::childDied(int pid) +{ + hide(); +} + + + int main(int argc, char** argv) { Gtk::Main app(argc, argv); - + GraphicalStapLauncher launcher; GrapherWindow win; win.set_title("Grapher"); win.set_default_size(600, 200); + launcher.setWinParams(&win, &win.w); - StapParser stapParser(win, win.w); - launcher.setStapParser(&stapParser); - GraphicalStapLauncher graphicalLauncher(&launcher); - win.setGraphicalLauncher(&graphicalLauncher); - if (argc > 1) - { - launcher.setArgv(argv + 1); - launcher.setDeathCallback(&win); - launcher.launch(); - } - else + win.setGraphicalLauncher(&launcher); + + if (argc == 2 && !std::strcmp(argv[1], "-")) { - Glib::signal_io().connect(sigc::mem_fun(stapParser, + tr1::shared_ptr sp = launcher.makeStapParser(); + sp->setInFd(STDIN_FILENO); + Glib::signal_io().connect(sigc::mem_fun(sp.get(), &StapParser::ioCallback), STDIN_FILENO, Glib::IO_IN | Glib::IO_HUP); } + else if (argc > 1) + { + launcher.setArgv(argv + 1); + launcher.setDeathCallback(&win); + launcher.launch(); + } Gtk::Main::run(win); launcher.cleanUp(); return 0; @@ -386,8 +398,7 @@ void GrapherWindow::addGraph() } -GraphicalStapLauncher::GraphicalStapLauncher(StapLauncher* launcher) - : _launcher(launcher) +GraphicalStapLauncher::GraphicalStapLauncher() { try { @@ -421,10 +432,10 @@ bool GraphicalStapLauncher::runDialog() void GraphicalStapLauncher::onLaunch() { - _launcher->setArgs(_stapArgEntry->get_text(), _chooserButton->get_filename(), - _scriptArgEntry->get_text()); + setArgs(_stapArgEntry->get_text(), _chooserButton->get_filename(), + _scriptArgEntry->get_text()); _scriptWindow->hide(); - _launcher->launch(); + launch(); } void GraphicalStapLauncher::onLaunchCancel() -- cgit From 8447d5545aa58965a5f47d604e14e97e673d1cd9 Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Tue, 27 Oct 2009 12:50:25 +0100 Subject: Kill off child processes correctly on exit. * grapher/grapher.cxx (ChildDeathReader::reap): New function. (StapLauncher): Keep a list of instantiated parsers. (StapLauncher::cleanup): Kill off all launched stap processes. --- grapher/grapher.cxx | 130 ++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 100 insertions(+), 30 deletions(-) (limited to 'grapher') diff --git a/grapher/grapher.cxx b/grapher/grapher.cxx index 598f389b..fe9880b2 100644 --- a/grapher/grapher.cxx +++ b/grapher/grapher.cxx @@ -15,6 +15,8 @@ #include +#include + #include #include #include @@ -61,6 +63,20 @@ public: ChildDeathReader(int sigfd_) : sigfd(sigfd_) {} int getSigfd() { return sigfd; } void setSigfd(int sigfd_) { sigfd = sigfd_; } + virtual pid_t reap() + { + pid_t pid; + int status; + if ((pid = waitpid(-1, &status, WNOHANG)) == -1) + { + std::perror("waitpid"); + return -1; + } + else + { + return pid; + } + } bool ioCallback(Glib::IOCondition ioCondition) { if ((ioCondition & Glib::IO_IN) == 0) @@ -69,9 +85,7 @@ public: if (read(sigfd, &buf, 1) <= 0) return true; - int status; - while (wait(&status) != -1) - ; + reap(); return true; } private: @@ -140,9 +154,31 @@ public: tr1::shared_ptr makeStapParser() { tr1::shared_ptr result(new StapParser(_win, _widget)); - _stapParsers.push_back(result); + _parsers.push_back(ParserInstance(-1, result)); return result; } + pid_t reap() + { + pid_t pid = ChildDeathReader::reap(); + if (pid < 0) + return pid; + ParserList::iterator itr + = find_if(_parsers.begin(), _parsers.end(), + boost::bind(&ParserInstance::childPid, _1) == pid); + if (itr != _parsers.end()) + itr->childPid = -1; + return pid; + } + void killAll() + { + for (ParserList::iterator itr = _parsers.begin(), end = _parsers.end(); + itr != end; + ++itr) + { + if (itr->childPid >= 0) + kill(itr->childPid, SIGTERM); + } + } protected: char** _argv; string _stapArgs; @@ -152,15 +188,37 @@ protected: ChildDeathReader::Callback* _deathCallback; Gtk::Window* _win; GraphWidget* _widget; - vector > _stapParsers; + struct ParserInstance + { + ParserInstance() : childPid(-1) {} + ParserInstance(int childPid_, tr1::shared_ptr stapParser_) + : childPid(childPid_), stapParser(stapParser_) + { + } + pid_t childPid; + tr1::shared_ptr stapParser; + }; + typedef vector ParserList; + ParserList _parsers; }; int StapLauncher::launch() { - if (pipe(&signalPipe[0]) < 0) + int childPid = -1; + if (signalPipe[0] < 0) { - std::perror("pipe"); - exit(1); + if (pipe(&signalPipe[0]) < 0) + { + std::perror("pipe"); + exit(1); + } + setSigfd(signalPipe[0]); + if (signalPipe[0] >= 0) + { + Glib::signal_io().connect(sigc::mem_fun(*this, + &ChildDeathReader::ioCallback), + signalPipe[0], Glib::IO_IN); + } } struct sigaction action; action.sa_sigaction = handleChild; @@ -178,11 +236,11 @@ int StapLauncher::launch() std::perror("pipe"); exit(1); } - if ((_childPid = fork()) == -1) + if ((childPid = fork()) == -1) { exit(1); } - else if (_childPid) + else if (childPid) { close(pipefd[1]); close(pipefd[3]); @@ -191,8 +249,8 @@ int StapLauncher::launch() { dup2(pipefd[1], STDOUT_FILENO); dup2(pipefd[3], STDERR_FILENO); - for (int i = 0; i < 4; ++i) - close(pipefd[i]); + for_each(&pipefd[0], &pipefd[4], close); + for_each(&signalPipe[0], &signalPipe[2], close); if (_argv) { char argv0[] = "stap"; @@ -214,38 +272,51 @@ int StapLauncher::launch() _exit(1); } tr1::shared_ptr sp(new StapParser(_win, _widget)); - _stapParsers.push_back(sp); + _parsers.push_back(ParserInstance(childPid, sp)); sp->setErrFd(pipefd[2]); sp->setInFd(pipefd[0]); Glib::signal_io().connect(sigc::mem_fun(sp.get(), &StapParser::errIoCallback), pipefd[2], Glib::IO_IN); - setSigfd(signalPipe[0]); - if (signalPipe[0] >= 0) - { - Glib::signal_io().connect(sigc::mem_fun(*this, - &ChildDeathReader::ioCallback), - signalPipe[0], Glib::IO_IN); - } Glib::signal_io().connect(sigc::mem_fun(sp.get(), &StapParser::ioCallback), pipefd[0], Glib::IO_IN | Glib::IO_HUP); - return _childPid; + return childPid; } void StapLauncher::cleanUp() { - if (_childPid > 0) - kill(_childPid, SIGTERM); - int status; - while (wait(&status) != -1) - ; - if (_deathCallback) + struct sigaction action; + action.sa_handler = SIG_DFL; + sigemptyset(&action.sa_mask); + action.sa_flags = 0; + sigaction(SIGCLD, &action, 0); + // Drain any outstanding signals + close(signalPipe[1]); + char buf; + while (read(signalPipe[0], &buf, 1) > 0) + reap(); + for (ParserList::iterator itr = _parsers.begin(), end = _parsers.end(); + itr != end; + ++itr) { - _deathCallback->childDied(_childPid); - _childPid = -1; + if (itr->childPid > 0) + kill(itr->childPid, SIGTERM); + int status; + pid_t killedPid = -1; + if ((killedPid = wait(&status)) == -1) + { + std::perror("wait"); + } + else if (killedPid != itr->childPid) + { + std::cerr << "wait: killed Pid " << killedPid << " != child Pid " + << itr->childPid << "\n"; + } + else if (_deathCallback) + _deathCallback->childDied(itr->childPid); } } @@ -262,7 +333,6 @@ private: Gtk::FileChooserButton* _chooserButton; Gtk::Entry* _stapArgEntry; Gtk::Entry* _scriptArgEntry; - StapLauncher* _launcher; }; class GrapherWindow : public Gtk::Window, public ChildDeathReader::Callback -- cgit From 1fc4d13df3342b10003c27bc0bc8bd196ecd5622 Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Wed, 28 Oct 2009 18:57:50 +0100 Subject: Fix regression of parsing grapher options * grapher/StapParser.hxx (ioCallback): Test return value from findTaggedValue properly. --- grapher/StapParser.cxx | 56 +++++++++++++++++++++++++------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) (limited to 'grapher') diff --git a/grapher/StapParser.cxx b/grapher/StapParser.cxx index 249836d3..9e42dab6 100644 --- a/grapher/StapParser.cxx +++ b/grapher/StapParser.cxx @@ -156,18 +156,15 @@ vector commaSplit(const boost::sub_range& range) shared_ptr gdata = itr->second; string decl; // Hack: scan from the beginning of dataString again - if (findTaggedValue(dataString, "%Title:", decl) - != string::npos) + if (findTaggedValue(dataString, "%Title:", decl)) { gdata->title = decl; } - else if (findTaggedValue(dataString, "%XAxisTitle:", decl) - != string::npos) + else if (findTaggedValue(dataString, "%XAxisTitle:", decl)) { gdata->xAxisText = decl; } - else if (findTaggedValue(dataString, "%YAxisTitle:", decl) - != string::npos) + else if (findTaggedValue(dataString, "%YAxisTitle:", decl)) { gdata->yAxisText = decl; } @@ -179,29 +176,32 @@ vector commaSplit(const boost::sub_range& range) stream >> ymax; gdata->scale = ymax; } - - if (!_csv.elements.empty()) - { - vector tokens = commaSplit(dataString); - int i = 0; - double time; - vector::iterator tokIter = tokens.begin(); - std::istringstream timeStream(*tokIter++); - timeStream >> time; - for (vector::iterator e = tokens.end(); - tokIter != e; - ++tokIter, ++i) - { - parseData(_csv.elements[i].second, time, *tokIter); - } - } else - { - double time; - string data; - stream >> time >> data; - parseData(itr->second, time, data); - } + { + if (!_csv.elements.empty()) + { + vector tokens = commaSplit(dataString); + int i = 0; + double time; + vector::iterator tokIter = tokens.begin(); + std::istringstream timeStream(*tokIter++); + timeStream >> time; + for (vector::iterator e = tokens.end(); + tokIter != e; + ++tokIter, ++i) + { + parseData(_csv.elements[i].second, time, + *tokIter); + } + } + else + { + double time; + string data; + stream >> time >> data; + parseData(itr->second, time, data); + } + } } } _buffer.erase(0, ret + 1); -- cgit From f2eafd28f50fb528842502e138c14ea2e54145b6 Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Wed, 28 Oct 2009 22:13:50 +0100 Subject: * grapher/GraphData.hxx (GraphDataBase, GraphData): Use boost::circular_buffer for time and data storage. --- grapher/GraphData.hxx | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'grapher') diff --git a/grapher/GraphData.hxx b/grapher/GraphData.hxx index e4c08cfd..0e26fb4d 100644 --- a/grapher/GraphData.hxx +++ b/grapher/GraphData.hxx @@ -6,6 +6,8 @@ #include #include +#include + namespace systemtap { struct GraphDataBase @@ -16,11 +18,12 @@ namespace systemtap DOT, EVENT }; - GraphDataBase() : scale(1.0), style(BAR) + typedef boost::circular_buffer TimeList; + GraphDataBase(TimeList::capacity_type cap = 50000) + : scale(1.0), style(BAR), times(cap) { color[0] = 0.0; color[1] = 1.0; color[2] = 0.0; } - typedef std::vector TimeList; // size of grid square at "normal" viewing double scale; double color[3]; @@ -36,7 +39,11 @@ namespace systemtap { public: typedef T data_type; - typedef std::vector DataList; + typedef boost::circular_buffer DataList; + GraphData(typename DataList::capacity_type cap = 50000) + : GraphDataBase(cap), data(cap) + { + } DataList data; }; struct CSVData -- cgit