diff options
-rw-r--r-- | CairoWidget.cxx | 42 | ||||
-rw-r--r-- | CairoWidget.hxx | 42 | ||||
-rw-r--r-- | GraphData.hxx | 44 | ||||
-rw-r--r-- | GraphWidget.cxx | 323 | ||||
-rw-r--r-- | GraphWidget.hxx | 62 | ||||
-rw-r--r-- | Makefile.am | 6 | ||||
-rw-r--r-- | Makefile.in | 67 | ||||
-rw-r--r-- | aclocal.m4 | 156 | ||||
-rwxr-xr-x | configure | 236 | ||||
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | doc/Makefile.in | 3 | ||||
-rw-r--r-- | doc/SystemTap_Tapset_Reference/Makefile.in | 3 | ||||
-rw-r--r-- | grapher.cxx | 127 | ||||
-rw-r--r-- | testsuite/systemtap.examples/general/grapher.stp | 32 |
14 files changed, 1140 insertions, 4 deletions
diff --git a/CairoWidget.cxx b/CairoWidget.cxx new file mode 100644 index 00000000..86498a4f --- /dev/null +++ b/CairoWidget.cxx @@ -0,0 +1,42 @@ +#include "CairoWidget.hxx" + +#include <math.h> + +namespace systemtap +{ + void CairoPlayButton::draw(Cairo::RefPtr<Cairo::Context> cr) + { + if (!_visible) + return; + cr->save(); + cr->set_line_width(1.0); + // square with rounded corners + cr->move_to(_x0, _y0 + _radius); + cr->arc(_x0 + _radius, _y0 + _radius, _radius, M_PI, -M_PI_2); + cr->line_to(_x0 + _size - _radius, _y0); + cr->arc(_x0 + _size - _radius, _y0 + _radius, _radius, -M_PI_2, 0.0); + cr->line_to(_x0 + _size, _y0 + _size - _radius); + cr->arc(_x0 + _size - _radius, _y0 + _size - _radius, _radius, 0.0, M_PI_2); + cr->line_to(_x0 + _radius, _y0 + _size); + cr->arc(_x0 + _radius, _y0 + _size - _radius, _radius, M_PI_2, M_PI); + cr->close_path(); + //cr->rectangle(_x0, _y0, 50.0, 50.0); + cr->set_source_rgba(1.0, 1.0, 1.0, .8); + cr->stroke(); + // play equalateral triangle + cr->move_to(_x0 + .25 * _size, _y0 + (.5 - 1.0 / (sqrt(3.0) * 2.0)) * _size); + cr->line_to(_x0 + .75 * _size, _y0 + .5 * _size); + cr->line_to(_x0 + .25 * _size, _y0 + (.5 + 1.0 / (sqrt(3.0) * 2.0)) * _size); + cr->close_path(); + cr->fill(); + cr->restore(); + } + + bool CairoPlayButton::containsPoint(double x, double y) + { + if (x >= _x0 && (x < (_x0 + 50.0)) && (y >= _y0) && (y < (_y0 + 50))) + return true; + else + return false; + } +} diff --git a/CairoWidget.hxx b/CairoWidget.hxx new file mode 100644 index 00000000..077a4c7a --- /dev/null +++ b/CairoWidget.hxx @@ -0,0 +1,42 @@ +#ifndef SYSTEMTAP_CAIROWIDGET_H +#define SYSTEMTAP_CAIROWIDGET_H 1 + +#include <cairomm/context.h> +namespace systemtap +{ + class CairoWidget + { + public: + CairoWidget(bool visible = false) + : _visible(visible), _size(50.0), _radius(5) + {} + bool isVisible() const { return _visible; } + void setVisible(bool visible) { _visible = visible; } + void getOrigin(double &x, double &y) const + { + x = _x0; + y = _y0; + } + void setOrigin(double x, double y) + { + _x0 = x; + _y0 = y; + } + virtual void draw(Cairo::RefPtr<Cairo::Context> cr) = 0; + virtual bool containsPoint(double x, double y) { return false; } + protected: + bool _visible; + double _x0; + double _y0; + double _size; + double _radius; + }; + + class CairoPlayButton : public CairoWidget + { + public: + virtual void draw(Cairo::RefPtr<Cairo::Context> cr); + virtual bool containsPoint(double x, double y); + }; +} +#endif diff --git a/GraphData.hxx b/GraphData.hxx new file mode 100644 index 00000000..0f3b0b31 --- /dev/null +++ b/GraphData.hxx @@ -0,0 +1,44 @@ +#ifndef SYSTEMTAP_GRAPHDATA_HXX +#define SYSTEMTAP_GRAPHDATA_HXX 1 + +#include <utility> +#include <vector> + +namespace systemtap +{ + struct GraphData + { + public: + enum Style + { BAR, + DOT + }; + GraphData() : scale(1.0), style(BAR) + { + color[0] = 0.0; color[1] = 1.0; color[2] = 0.0; + } + typedef std::pair<double, double> Datum; + typedef std::vector<Datum> List; + // size of grid square at "normal" viewing + double scale; + double color[3]; + Style style; + List data; + struct Compare + { + bool operator() (const Datum& lhs, const Datum& rhs) const + { + return lhs.first < rhs.first; + } + bool operator() (double lhs, const Datum& rhs) const + { + return lhs < rhs.first; + } + bool operator() (const Datum& lhs, double rhs) const + { + return lhs.first < rhs; + } + }; + }; +} +#endif diff --git a/GraphWidget.cxx b/GraphWidget.cxx new file mode 100644 index 00000000..5186c471 --- /dev/null +++ b/GraphWidget.cxx @@ -0,0 +1,323 @@ +#include <algorithm> +#include <ctime> +#include <math.h> +#include <sstream> +#include <iomanip> +#include <cairomm/context.h> +#include "GraphWidget.hxx" +#include "CairoWidget.hxx" + +namespace systemtap +{ + GraphWidget::GraphWidget() + : _left(0.0), _right(1.0), _top(1.0), _bottom(0.0), _lineWidth(10), + _autoScaling(true), _autoScrolling(true), _zoomFactor(1.0), + _trackingDrag(false), _playButton(new CairoPlayButton) + { + add_events(Gdk::POINTER_MOTION_MASK | Gdk::BUTTON_PRESS_MASK + | Gdk::BUTTON_RELEASE_MASK | Gdk::SCROLL_MASK); + Glib::signal_timeout() + .connect(sigc::mem_fun(*this, &GraphWidget::on_timeout), 1000); + signal_expose_event() + .connect(sigc::mem_fun(*this, &GraphWidget::on_expose_event), false); + signal_button_press_event() + .connect(sigc::mem_fun(*this, &GraphWidget::on_button_press_event), + false); + signal_button_release_event() + .connect(sigc::mem_fun(*this, &GraphWidget::on_button_release_event), + false); + signal_motion_notify_event() + .connect(sigc::mem_fun(*this, &GraphWidget::on_motion_notify_event), + false); + signal_scroll_event() + .connect(sigc::mem_fun(*this, &GraphWidget::on_scroll_event), false); + } + + void GraphWidget::getExtents(double& left, double& right, double& top, + double& bottom) const + { + left = _left; + right = _right; + top = _top; + bottom = _bottom; + } + + void GraphWidget::setExtents(double left, double right, double top, + double bottom) + { + _left = left; + _right = right; + _top = top; + _bottom = bottom; + + } + GraphWidget::~GraphWidget() + { + } + + void GraphWidget::addGraphData(std::tr1::shared_ptr<GraphData> data) + { + _datasets.push_back(data); + } + + bool GraphWidget::on_expose_event(GdkEventExpose* event) + { + // This is where we draw on the window + Glib::RefPtr<Gdk::Window> window = get_window(); + if(!window) + return true; + + Gtk::Allocation allocation = get_allocation(); + + const int graphWidth = allocation.get_width(); + const int graphHeight = allocation.get_height(); + const int width = graphWidth - 20; + const int height = graphHeight - 20; + + Cairo::RefPtr<Cairo::Context> cr = window->create_cairo_context(); + if(event && !_autoScaling) + { + // clip to the area indicated by the expose event so that we only + // redraw the portion of the window that needs to be redrawn + cr->rectangle(event->area.x, event->area.y, + event->area.width, event->area.height); + cr->clip(); + } + if (_autoScaling) + { + // line separation + int linesPossible = width / (_lineWidth + 2); + // Find latest time. + double latestTime = 0; + for (DatasetList::iterator ditr = _datasets.begin(), + de = _datasets.end(); + ditr != de; + ++ditr) + { + if (!(*ditr)->data.empty()) + { + double lastDataTime = (*ditr)->data.back().first; + if (lastDataTime > latestTime) + latestTime = lastDataTime; + } + } + double minDiff = 0.0; + double maxTotal = 0.0; + for (DatasetList::iterator ditr = _datasets.begin(), + de = _datasets.end(); + ditr != de; + ++ditr) + { + GraphData::List& gdata = (*ditr)->data; + if (gdata.size() <= 1) + continue; + double totalDiff = 0.0; + for (GraphData::List::reverse_iterator ritr = gdata.rbegin(), + re = gdata.rend(); + ritr + 1 != gdata.rend(); + ritr++) + { + double timeDiff = ritr->first - (ritr + 1)->first; + if (timeDiff < minDiff || (timeDiff != 0 && minDiff == 0)) + minDiff = timeDiff; + if (minDiff != 0 + && (totalDiff + timeDiff) / minDiff > linesPossible) + break; + totalDiff += timeDiff; + } + if (totalDiff > maxTotal) + maxTotal = totalDiff; + } + // Now we have a global scale. + _right = latestTime; + if (maxTotal != 0) + _left = latestTime - maxTotal; + else + _left = _right - 1.0; + } + cr->save(); + double horizScale = _zoomFactor * width / ( _right - _left); + cr->translate(20.0, 0.0); + cr->set_line_width(_lineWidth); + cr->save(); + cr->set_source_rgba(0.0, 0.0, 0.0, 1.0); + cr->paint(); + cr->restore(); + + for (DatasetList::iterator itr = _datasets.begin(), e = _datasets.end(); + itr != e; + ++itr) + { + cr->save(); + cr->translate(0.0, height); + cr->scale(1.0, -1.0); + GraphData::List::iterator lower + = std::lower_bound((*itr)->data.begin(), (*itr)->data.end(), _left, + GraphData::Compare()); + GraphData::List::iterator upper + = std::upper_bound((*itr)->data.begin(), (*itr)->data.end(), _right, + GraphData::Compare()); + for (GraphData::List::iterator ditr = lower, de = upper; + ditr != de; + ++ditr) + { + cr->set_source_rgba((*itr)->color[0], (*itr)->color[1], + (*itr)->color[2], 1.0); + if ((*itr)->style == GraphData::BAR) + { + cr->move_to((ditr->first - _left) * horizScale, 0); + cr->line_to((ditr->first - _left) * horizScale, + ditr->second * height / (*itr)->scale); + cr->stroke(); + } + else + { + cr->arc((ditr->first - _left) * horizScale, + ditr->second * height / (*itr)->scale, + _lineWidth / 2.0, 0.0, M_PI * 2.0); + cr->fill(); + } + } + cr->restore(); + } + cr->restore(); + cr->save(); + cr->select_font_face("Sans", Cairo::FONT_SLANT_NORMAL, + Cairo::FONT_WEIGHT_BOLD); + cr->set_font_size(14.0); + cr->set_source_rgba(1.0, 1.0, 1.0, .8); + + if (!_title.empty()) + { + cr->move_to(20.0, 20.0); + cr->show_text(_title); + } + if (!_xAxisText.empty()) + { + cr->move_to(10.0, graphHeight - 5); + cr->show_text(_xAxisText); + } + if (!_yAxisText.empty()) + { + cr->save(); + cr->translate(10.0, height - 10.0); + cr->rotate(-M_PI / 2.0); + cr->move_to(10.0, 0.0); + cr->show_text(_yAxisText); + cr->restore(); + } + cr->restore(); + // Draw axes + double diff = _right - _left; + double majorUnit = pow(10.0, floor(log(diff) / log(10.0))); + double startTime = floor(_left / majorUnit) * majorUnit; + cr->save(); + cr->set_source_rgba(1.0, 1.0, 1.0, .9); + cr->set_line_cap(Cairo::LINE_CAP_BUTT); + cr->set_line_width(_lineWidth); + cr->select_font_face("Sans", Cairo::FONT_SLANT_NORMAL, + Cairo::FONT_WEIGHT_NORMAL); + cr->set_font_size(10.0); + cr->move_to(20.0, 0.0); + cr->line_to(20.0, height); + cr->move_to(20.0, height); + cr->line_to(graphWidth, height); + cr->stroke(); + std::vector<double> dash(1); + dash[0] = height / 10; + cr->set_dash(dash, 0); + for (double tickVal = startTime; tickVal < _right; tickVal += majorUnit) + { + cr->move_to((tickVal - _left) * horizScale + 20.0, graphHeight - 5); + std::ostringstream stream; + stream << std::fixed << std::setprecision(0) << tickVal; + cr->show_text(stream.str()); + cr->move_to((tickVal - _left) * horizScale + 20.0, 0.0); + cr->line_to((tickVal - _left) * horizScale + 20.0, height); + cr->stroke(); + } + cr->stroke(); + cr->restore(); + + if (!_autoScrolling) + { + _playButton->setVisible(true); + _playButton->setOrigin(width / 2 - 25, .875 * height - 50); + _playButton->draw(cr); + } + + return true; + } + + bool GraphWidget::on_button_press_event(GdkEventButton* event) + { + if (!_autoScrolling && _playButton->containsPoint(event->x, event->y)) + { + _autoScaling = true; + _autoScrolling = true; + queue_draw(); + } + else + { + _trackingDrag = true; + _autoScaling = false; + _autoScrolling = false; + _dragOriginX = event->x; + _dragOriginY = event->y; + _dragOrigLeft = _left; + _dragOrigRight = _right; + } + return true; + } + + bool GraphWidget::on_button_release_event(GdkEventButton* event) + { + _trackingDrag = false; + return true; + } + + bool GraphWidget::on_motion_notify_event(GdkEventMotion* event) + { + Glib::RefPtr<Gdk::Window> win = get_window(); + if(!win) + return true; + double x; + double y; + // XXX Hint + if (event->is_hint) + { + } + else + { + x = event->x; + y = event->y; + } + if (_trackingDrag) + { + Gtk::Allocation allocation = get_allocation(); + const int width = allocation.get_width(); + double motion = (x - _dragOriginX) / (double) width; + double increment = motion * (_dragOrigLeft - _dragOrigRight); + _left = _dragOrigLeft + increment; + _right = _dragOrigRight + increment; + queue_draw(); + } + return true; + } + + bool GraphWidget::on_scroll_event(GdkEventScroll* event) + { + if (event->direction == GDK_SCROLL_UP) + _zoomFactor += .1; + else if (event->direction == GDK_SCROLL_DOWN) + _zoomFactor -= .1; + queue_draw(); + return true; + } + + bool GraphWidget::on_timeout() + { + queue_draw(); + return true; + } +} diff --git a/GraphWidget.hxx b/GraphWidget.hxx new file mode 100644 index 00000000..46075b78 --- /dev/null +++ b/GraphWidget.hxx @@ -0,0 +1,62 @@ +#ifndef SYSTEMTAP_GRAPHWIDGET_H +#define SYSTEMTAP_GRAPHWIDGET_H + +#include <string> +#include <vector> +#include <tr1/memory> + +#include <gtkmm/drawingarea.h> +#include "GraphData.hxx" + +namespace systemtap +{ + class CairoPlayButton; + + class GraphWidget : public Gtk::DrawingArea + { + public: + GraphWidget(); + virtual ~GraphWidget(); + void addGraphData(std::tr1::shared_ptr<GraphData> data); + void getExtents(double& left, double& right, double& top, double& bottom) const; + void setExtents(double left, double right, double top, double bottom); + double getLineWidth() { return _lineWidth; } + void setLineWidth(double lineWidth) { _lineWidth = lineWidth; } + bool getAutoScaling() const { return _autoScaling; } + void setAutoScaling(bool val) { _autoScaling = val; } + std::string getTitle() const { return _title; } + void setTitle(const std::string& title) { _title = title; } + std::string getXAxisText() const { return _xAxisText; } + void setXAxisText(const std::string& text) { _xAxisText = text; } + std::string getYAxisText() const { return _yAxisText; } + void setYAxisText(const std::string& text) { _yAxisText = text; } + protected: + //Override default signal handler: + virtual bool on_expose_event(GdkEventExpose* event); + virtual bool on_motion_notify_event(GdkEventMotion* event); + virtual bool on_button_press_event(GdkEventButton* event); + virtual bool on_button_release_event(GdkEventButton* event); + virtual bool on_scroll_event(GdkEventScroll* event); + bool on_timeout(); + typedef std::vector<std::tr1::shared_ptr<GraphData> > DatasetList; + DatasetList _datasets; + double _left; + double _right; + double _top; + double _bottom; + double _lineWidth; + bool _autoScaling; + bool _autoScrolling; + double _zoomFactor; + bool _trackingDrag; + double _dragOriginX; + double _dragOriginY; + double _dragOrigLeft; + double _dragOrigRight; + std::string _title; + std::string _xAxisText; + std::string _yAxisText; + std::tr1::shared_ptr<CairoPlayButton> _playButton; + }; +} +#endif // SYSTEMTAP_GRAPHWIDGET_H diff --git a/Makefile.am b/Makefile.am index f5fedae1..26a4760e 100644 --- a/Makefile.am +++ b/Makefile.am @@ -23,7 +23,7 @@ man/stapprobes.signal.3stap man/stapprobes.socket.3stap \ man/stapprobes.tcp.3stap man/stapprobes.udp.3stap # see also configure.ac -bin_PROGRAMS = stap staprun +bin_PROGRAMS = stap staprun grapher bin_SCRIPTS = stap-report oldinclude_HEADERS = includes/sys/sdt.h if BUILD_SERVER @@ -86,6 +86,10 @@ stap_CXXFLAGS = $(AM_CXXFLAGS) @PIECXXFLAGS@ stap_CPPFLAGS = $(AM_CPPFLAGS) stap_LDFLAGS = $(AM_LDFLAGS) @PIELDFLAGS@ +grapher_CXXFLAGS = $(GRAPHER_CFLAGS) +grapher_SOURCES = grapher.cxx GraphWidget.cxx CairoWidget.cxx +grapher_LDADD = $(GRAPHER_LIBS) + if BUILD_SERVER stap_client_connect_LDFLAGS = $(AM_LDFLAGS) stap_server_connect_LDFLAGS = $(AM_LDFLAGS) diff --git a/Makefile.in b/Makefile.in index a953be51..5592ad28 100644 --- a/Makefile.in +++ b/Makefile.in @@ -34,7 +34,8 @@ POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : -bin_PROGRAMS = stap$(EXEEXT) staprun$(EXEEXT) $(am__EXEEXT_1) +bin_PROGRAMS = stap$(EXEEXT) staprun$(EXEEXT) grapher$(EXEEXT) \ + $(am__EXEEXT_1) @BUILD_SERVER_TRUE@am__append_1 = stap-server.8 @BUILD_SERVER_TRUE@am__append_2 = stap-client-connect stap-server-connect @BUILD_SERVER_TRUE@am__append_3 = stap-client stap-serverd stap-server stap-find-servers \ @@ -99,10 +100,16 @@ am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkglibexecdir)" \ binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) pkglibexecPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) $(pkglibexec_PROGRAMS) +am_grapher_OBJECTS = grapher-grapher.$(OBJEXT) \ + grapher-GraphWidget.$(OBJEXT) grapher-CairoWidget.$(OBJEXT) +grapher_OBJECTS = $(am_grapher_OBJECTS) +am__DEPENDENCIES_1 = +grapher_DEPENDENCIES = $(am__DEPENDENCIES_1) +grapher_LINK = $(CXXLD) $(grapher_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ am_loc2c_test_OBJECTS = loc2c_test-loc2c-test.$(OBJEXT) \ loc2c_test-loc2c.$(OBJEXT) loc2c_test_OBJECTS = $(am_loc2c_test_OBJECTS) -am__DEPENDENCIES_1 = loc2c_test_DEPENDENCIES = $(am__DEPENDENCIES_1) loc2c_test_LINK = $(CCLD) $(loc2c_test_CFLAGS) $(CFLAGS) \ $(loc2c_test_LDFLAGS) $(LDFLAGS) -o $@ @@ -154,7 +161,7 @@ CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ CXXLD = $(CXX) CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ -SOURCES = $(loc2c_test_SOURCES) $(stap_SOURCES) \ +SOURCES = $(grapher_SOURCES) $(loc2c_test_SOURCES) $(stap_SOURCES) \ $(stap_client_connect_SOURCES) $(stap_server_connect_SOURCES) \ $(stapio_SOURCES) $(staprun_SOURCES) RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ @@ -205,6 +212,8 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +GRAPHER_CFLAGS = @GRAPHER_CFLAGS@ +GRAPHER_LIBS = @GRAPHER_LIBS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ @@ -230,6 +239,7 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PIECFLAGS = @PIECFLAGS@ PIECXXFLAGS = @PIECXXFLAGS@ PIELDFLAGS = @PIELDFLAGS@ +PKG_CONFIG = @PKG_CONFIG@ PROCFLAGS = @PROCFLAGS@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ @@ -332,6 +342,9 @@ stap_CFLAGS = $(AM_CFLAGS) @PIECFLAGS@ stap_CXXFLAGS = $(AM_CXXFLAGS) @PIECXXFLAGS@ stap_CPPFLAGS = $(AM_CPPFLAGS) $(am__append_4) stap_LDFLAGS = $(AM_LDFLAGS) @PIELDFLAGS@ $(am__append_5) +grapher_CXXFLAGS = $(GRAPHER_CFLAGS) +grapher_SOURCES = grapher.cxx GraphWidget.cxx CairoWidget.cxx +grapher_LDADD = $(GRAPHER_LIBS) @BUILD_SERVER_TRUE@stap_client_connect_LDFLAGS = $(AM_LDFLAGS) @BUILD_SERVER_TRUE@stap_server_connect_LDFLAGS = $(AM_LDFLAGS) PHONIES = $(am__append_9) $(am__append_10) dist-gzip @@ -526,6 +539,9 @@ uninstall-pkglibexecPROGRAMS: clean-pkglibexecPROGRAMS: -test -z "$(pkglibexec_PROGRAMS)" || rm -f $(pkglibexec_PROGRAMS) +grapher$(EXEEXT): $(grapher_OBJECTS) $(grapher_DEPENDENCIES) + @rm -f grapher$(EXEEXT) + $(grapher_LINK) $(grapher_OBJECTS) $(grapher_LDADD) $(LIBS) loc2c-test$(EXEEXT): $(loc2c_test_OBJECTS) $(loc2c_test_DEPENDENCIES) @rm -f loc2c-test$(EXEEXT) $(loc2c_test_LINK) $(loc2c_test_OBJECTS) $(loc2c_test_LDADD) $(LIBS) @@ -570,6 +586,9 @@ mostlyclean-compile: distclean-compile: -rm -f *.tab.c +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/grapher-CairoWidget.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/grapher-GraphWidget.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/grapher-grapher.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/loc2c_test-loc2c-test.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/loc2c_test-loc2c.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stap-buildrun.Po@am__quote@ @@ -851,6 +870,48 @@ staprun-common.obj: runtime/staprun/common.c @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` +grapher-grapher.o: grapher.cxx +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(grapher_CXXFLAGS) $(CXXFLAGS) -MT grapher-grapher.o -MD -MP -MF $(DEPDIR)/grapher-grapher.Tpo -c -o grapher-grapher.o `test -f 'grapher.cxx' || echo '$(srcdir)/'`grapher.cxx +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/grapher-grapher.Tpo $(DEPDIR)/grapher-grapher.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='grapher.cxx' object='grapher-grapher.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(grapher_CXXFLAGS) $(CXXFLAGS) -c -o grapher-grapher.o `test -f 'grapher.cxx' || echo '$(srcdir)/'`grapher.cxx + +grapher-grapher.obj: grapher.cxx +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(grapher_CXXFLAGS) $(CXXFLAGS) -MT grapher-grapher.obj -MD -MP -MF $(DEPDIR)/grapher-grapher.Tpo -c -o grapher-grapher.obj `if test -f 'grapher.cxx'; then $(CYGPATH_W) 'grapher.cxx'; else $(CYGPATH_W) '$(srcdir)/grapher.cxx'; fi` +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/grapher-grapher.Tpo $(DEPDIR)/grapher-grapher.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='grapher.cxx' object='grapher-grapher.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(grapher_CXXFLAGS) $(CXXFLAGS) -c -o grapher-grapher.obj `if test -f 'grapher.cxx'; then $(CYGPATH_W) 'grapher.cxx'; else $(CYGPATH_W) '$(srcdir)/grapher.cxx'; fi` + +grapher-GraphWidget.o: GraphWidget.cxx +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(grapher_CXXFLAGS) $(CXXFLAGS) -MT grapher-GraphWidget.o -MD -MP -MF $(DEPDIR)/grapher-GraphWidget.Tpo -c -o grapher-GraphWidget.o `test -f 'GraphWidget.cxx' || echo '$(srcdir)/'`GraphWidget.cxx +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/grapher-GraphWidget.Tpo $(DEPDIR)/grapher-GraphWidget.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='GraphWidget.cxx' object='grapher-GraphWidget.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(grapher_CXXFLAGS) $(CXXFLAGS) -c -o grapher-GraphWidget.o `test -f 'GraphWidget.cxx' || echo '$(srcdir)/'`GraphWidget.cxx + +grapher-GraphWidget.obj: GraphWidget.cxx +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(grapher_CXXFLAGS) $(CXXFLAGS) -MT grapher-GraphWidget.obj -MD -MP -MF $(DEPDIR)/grapher-GraphWidget.Tpo -c -o grapher-GraphWidget.obj `if test -f 'GraphWidget.cxx'; then $(CYGPATH_W) 'GraphWidget.cxx'; else $(CYGPATH_W) '$(srcdir)/GraphWidget.cxx'; fi` +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/grapher-GraphWidget.Tpo $(DEPDIR)/grapher-GraphWidget.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='GraphWidget.cxx' object='grapher-GraphWidget.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(grapher_CXXFLAGS) $(CXXFLAGS) -c -o grapher-GraphWidget.obj `if test -f 'GraphWidget.cxx'; then $(CYGPATH_W) 'GraphWidget.cxx'; else $(CYGPATH_W) '$(srcdir)/GraphWidget.cxx'; fi` + +grapher-CairoWidget.o: CairoWidget.cxx +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(grapher_CXXFLAGS) $(CXXFLAGS) -MT grapher-CairoWidget.o -MD -MP -MF $(DEPDIR)/grapher-CairoWidget.Tpo -c -o grapher-CairoWidget.o `test -f 'CairoWidget.cxx' || echo '$(srcdir)/'`CairoWidget.cxx +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/grapher-CairoWidget.Tpo $(DEPDIR)/grapher-CairoWidget.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='CairoWidget.cxx' object='grapher-CairoWidget.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(grapher_CXXFLAGS) $(CXXFLAGS) -c -o grapher-CairoWidget.o `test -f 'CairoWidget.cxx' || echo '$(srcdir)/'`CairoWidget.cxx + +grapher-CairoWidget.obj: CairoWidget.cxx +@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(grapher_CXXFLAGS) $(CXXFLAGS) -MT grapher-CairoWidget.obj -MD -MP -MF $(DEPDIR)/grapher-CairoWidget.Tpo -c -o grapher-CairoWidget.obj `if test -f 'CairoWidget.cxx'; then $(CYGPATH_W) 'CairoWidget.cxx'; else $(CYGPATH_W) '$(srcdir)/CairoWidget.cxx'; fi` +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/grapher-CairoWidget.Tpo $(DEPDIR)/grapher-CairoWidget.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='CairoWidget.cxx' object='grapher-CairoWidget.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(grapher_CXXFLAGS) $(CXXFLAGS) -c -o grapher-CairoWidget.obj `if test -f 'CairoWidget.cxx'; then $(CYGPATH_W) 'CairoWidget.cxx'; else $(CYGPATH_W) '$(srcdir)/CairoWidget.cxx'; fi` + stap-main.o: main.cxx @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(stap_CPPFLAGS) $(CPPFLAGS) $(stap_CXXFLAGS) $(CXXFLAGS) -MT stap-main.o -MD -MP -MF $(DEPDIR)/stap-main.Tpo -c -o stap-main.o `test -f 'main.cxx' || echo '$(srcdir)/'`main.cxx @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/stap-main.Tpo $(DEPDIR)/stap-main.Po @@ -19,6 +19,162 @@ You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) +# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- +# +# Copyright © 2004 Scott James Remnant <scott@netsplit.com>. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# PKG_PROG_PKG_CONFIG([MIN-VERSION]) +# ---------------------------------- +AC_DEFUN([PKG_PROG_PKG_CONFIG], +[m4_pattern_forbid([^_?PKG_[A-Z_]+$]) +m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) +AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=m4_default([$1], [0.9.0]) + AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + PKG_CONFIG="" + fi + +fi[]dnl +])# PKG_PROG_PKG_CONFIG + +# PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) +# +# Check to see whether a particular set of modules exists. Similar +# to PKG_CHECK_MODULES(), but does not set variables or print errors. +# +# +# Similar to PKG_CHECK_MODULES, make sure that the first instance of +# this or PKG_CHECK_MODULES is called, or make sure to call +# PKG_CHECK_EXISTS manually +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_EXISTS], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +if test -n "$PKG_CONFIG" && \ + AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then + m4_ifval([$2], [$2], [:]) +m4_ifvaln([$3], [else + $3])dnl +fi]) + + +# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) +# --------------------------------------------- +m4_define([_PKG_CONFIG], +[if test -n "$$1"; then + pkg_cv_[]$1="$$1" + elif test -n "$PKG_CONFIG"; then + PKG_CHECK_EXISTS([$3], + [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], + [pkg_failed=yes]) + else + pkg_failed=untried +fi[]dnl +])# _PKG_CONFIG + +# _PKG_SHORT_ERRORS_SUPPORTED +# ----------------------------- +AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG]) +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi[]dnl +])# _PKG_SHORT_ERRORS_SUPPORTED + + +# PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], +# [ACTION-IF-NOT-FOUND]) +# +# +# Note that if there is a possibility the first call to +# PKG_CHECK_MODULES might not happen, you should be sure to include an +# explicit call to PKG_PROG_PKG_CONFIG in your configure.ac +# +# +# -------------------------------------------------------------- +AC_DEFUN([PKG_CHECK_MODULES], +[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl +AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl +AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl + +pkg_failed=no +AC_MSG_CHECKING([for $1]) + +_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) +_PKG_CONFIG([$1][_LIBS], [libs], [$2]) + +m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS +and $1[]_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details.]) + +if test $pkg_failed = yes; then + _PKG_SHORT_ERRORS_SUPPORTED + if test $_pkg_short_errors_supported = yes; then + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1` + else + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + + ifelse([$4], , [AC_MSG_ERROR(dnl +[Package requirements ($2) were not met: + +$$1_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +_PKG_TEXT +])], + [AC_MSG_RESULT([no]) + $4]) +elif test $pkg_failed = untried; then + ifelse([$4], , [AC_MSG_FAILURE(dnl +[The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +_PKG_TEXT + +To get pkg-config, see <http://pkg-config.freedesktop.org/>.])], + [$4]) +else + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + AC_MSG_RESULT([yes]) + ifelse([$3], , :, [$3]) +fi[]dnl +])# PKG_CHECK_MODULES + # Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation @@ -667,6 +667,9 @@ sqlite3_LIBS PIECXXFLAGS PIECFLAGS PIELDFLAGS +GRAPHER_LIBS +GRAPHER_CFLAGS +PKG_CONFIG RANLIB ANSI2KNR U @@ -787,6 +790,9 @@ CXX CXXFLAGS CCC CPP +PKG_CONFIG +GRAPHER_CFLAGS +GRAPHER_LIBS CXXCPP' ac_subdirs_all='testsuite' @@ -1456,6 +1462,11 @@ Some influential environment variables: CXX C++ compiler command CXXFLAGS C++ compiler flags CPP C preprocessor + PKG_CONFIG path to pkg-config utility + GRAPHER_CFLAGS + C compiler flags for GRAPHER, overriding pkg-config + GRAPHER_LIBS + linker flags for GRAPHER, overriding pkg-config CXXCPP C++ preprocessor Use these variables to override the choices made by `configure' or to help @@ -5971,6 +5982,231 @@ fi + +if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. +set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_PKG_CONFIG+set}" = set; then + $as_echo_n "(cached) " >&6 +else + case $PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + ;; +esac +fi +PKG_CONFIG=$ac_cv_path_PKG_CONFIG +if test -n "$PKG_CONFIG"; then + { $as_echo "$as_me:$LINENO: result: $PKG_CONFIG" >&5 +$as_echo "$PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_path_PKG_CONFIG"; then + ac_pt_PKG_CONFIG=$PKG_CONFIG + # Extract the first word of "pkg-config", so it can be a program name with args. +set dummy pkg-config; ac_word=$2 +{ $as_echo "$as_me:$LINENO: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then + $as_echo_n "(cached) " >&6 +else + case $ac_pt_PKG_CONFIG in + [\\/]* | ?:[\\/]*) + ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done +done +IFS=$as_save_IFS + + ;; +esac +fi +ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG +if test -n "$ac_pt_PKG_CONFIG"; then + { $as_echo "$as_me:$LINENO: result: $ac_pt_PKG_CONFIG" >&5 +$as_echo "$ac_pt_PKG_CONFIG" >&6; } +else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_pt_PKG_CONFIG" = x; then + PKG_CONFIG="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:$LINENO: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + PKG_CONFIG=$ac_pt_PKG_CONFIG + fi +else + PKG_CONFIG="$ac_cv_path_PKG_CONFIG" +fi + +fi +if test -n "$PKG_CONFIG"; then + _pkg_min_version=0.9.0 + { $as_echo "$as_me:$LINENO: checking pkg-config is at least version $_pkg_min_version" >&5 +$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } + if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:$LINENO: result: no" >&5 +$as_echo "no" >&6; } + PKG_CONFIG="" + fi + +fi + +pkg_failed=no +{ $as_echo "$as_me:$LINENO: checking for GRAPHER" >&5 +$as_echo_n "checking for GRAPHER... " >&6; } + +if test -n "$GRAPHER_CFLAGS"; then + pkg_cv_GRAPHER_CFLAGS="$GRAPHER_CFLAGS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"gtkmm-2.4 >= 2.8.0\"") >&5 + ($PKG_CONFIG --exists --print-errors "gtkmm-2.4 >= 2.8.0") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_GRAPHER_CFLAGS=`$PKG_CONFIG --cflags "gtkmm-2.4 >= 2.8.0" 2>/dev/null` +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +if test -n "$GRAPHER_LIBS"; then + pkg_cv_GRAPHER_LIBS="$GRAPHER_LIBS" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"gtkmm-2.4 >= 2.8.0\"") >&5 + ($PKG_CONFIG --exists --print-errors "gtkmm-2.4 >= 2.8.0") 2>&5 + ac_status=$? + $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; then + pkg_cv_GRAPHER_LIBS=`$PKG_CONFIG --libs "gtkmm-2.4 >= 2.8.0" 2>/dev/null` +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi + + + +if test $pkg_failed = yes; then + +if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then + _pkg_short_errors_supported=yes +else + _pkg_short_errors_supported=no +fi + if test $_pkg_short_errors_supported = yes; then + GRAPHER_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "gtkmm-2.4 >= 2.8.0" 2>&1` + else + GRAPHER_PKG_ERRORS=`$PKG_CONFIG --print-errors "gtkmm-2.4 >= 2.8.0" 2>&1` + fi + # Put the nasty error message in config.log where it belongs + echo "$GRAPHER_PKG_ERRORS" >&5 + + { { $as_echo "$as_me:$LINENO: error: Package requirements (gtkmm-2.4 >= 2.8.0) were not met: + +$GRAPHER_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables GRAPHER_CFLAGS +and GRAPHER_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. +" >&5 +$as_echo "$as_me: error: Package requirements (gtkmm-2.4 >= 2.8.0) were not met: + +$GRAPHER_PKG_ERRORS + +Consider adjusting the PKG_CONFIG_PATH environment variable if you +installed software in a non-standard prefix. + +Alternatively, you may set the environment variables GRAPHER_CFLAGS +and GRAPHER_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. +" >&2;} + { (exit 1); exit 1; }; } +elif test $pkg_failed = untried; then + { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +{ { $as_echo "$as_me:$LINENO: error: The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables GRAPHER_CFLAGS +and GRAPHER_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see <http://pkg-config.freedesktop.org/>. +See \`config.log' for more details." >&5 +$as_echo "$as_me: error: The pkg-config script could not be found or is too old. Make sure it +is in your PATH or set the PKG_CONFIG environment variable to the full +path to pkg-config. + +Alternatively, you may set the environment variables GRAPHER_CFLAGS +and GRAPHER_LIBS to avoid the need to call pkg-config. +See the pkg-config man page for more details. + +To get pkg-config, see <http://pkg-config.freedesktop.org/>. +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; }; } +else + GRAPHER_CFLAGS=$pkg_cv_GRAPHER_CFLAGS + GRAPHER_LIBS=$pkg_cv_GRAPHER_LIBS + { $as_echo "$as_me:$LINENO: result: yes" >&5 +$as_echo "yes" >&6; } + : +fi + # Check whether --enable-perfmon was given. if test "${enable_perfmon+set}" = set; then enableval=$enable_perfmon; diff --git a/configure.ac b/configure.ac index a953e156..0aca1cc1 100644 --- a/configure.ac +++ b/configure.ac @@ -24,6 +24,7 @@ AC_PROG_INSTALL AC_PROG_MAKE_SET AC_SUBST(CFLAGS) AC_SUBST(CXXFLAGS) +PKG_CHECK_MODULES([GRAPHER], [gtkmm-2.4 >= 2.8.0]) dnl Handle the perfmon option. AC_ARG_ENABLE([perfmon], diff --git a/doc/Makefile.in b/doc/Makefile.in index e23a6699..2818ae52 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -79,6 +79,8 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +GRAPHER_CFLAGS = @GRAPHER_CFLAGS@ +GRAPHER_LIBS = @GRAPHER_LIBS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ @@ -104,6 +106,7 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PIECFLAGS = @PIECFLAGS@ PIECXXFLAGS = @PIECXXFLAGS@ PIELDFLAGS = @PIELDFLAGS@ +PKG_CONFIG = @PKG_CONFIG@ PROCFLAGS = @PROCFLAGS@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ diff --git a/doc/SystemTap_Tapset_Reference/Makefile.in b/doc/SystemTap_Tapset_Reference/Makefile.in index 6fe6bab2..2ea897c6 100644 --- a/doc/SystemTap_Tapset_Reference/Makefile.in +++ b/doc/SystemTap_Tapset_Reference/Makefile.in @@ -82,6 +82,8 @@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ +GRAPHER_CFLAGS = @GRAPHER_CFLAGS@ +GRAPHER_LIBS = @GRAPHER_LIBS@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ @@ -107,6 +109,7 @@ PATH_SEPARATOR = @PATH_SEPARATOR@ PIECFLAGS = @PIECFLAGS@ PIECXXFLAGS = @PIECXXFLAGS@ PIELDFLAGS = @PIELDFLAGS@ +PKG_CONFIG = @PKG_CONFIG@ PROCFLAGS = @PROCFLAGS@ RANLIB = @RANLIB@ SET_MAKE = @SET_MAKE@ diff --git a/grapher.cxx b/grapher.cxx new file mode 100644 index 00000000..46182178 --- /dev/null +++ b/grapher.cxx @@ -0,0 +1,127 @@ +#include "GraphWidget.hxx" + +#include <cmath> +#include <sstream> +#include <string> +#include <map> + +#include <gtkmm/main.h> +#include <gtkmm/window.h> +#include <unistd.h> +#include <poll.h> + +using namespace systemtap; + +class StapParser +{ + Glib::ustring _buffer; + typedef std::map<std::string, std::tr1::shared_ptr<GraphData> > DataMap; + DataMap _dataSets; + Gtk::Window& _win; + GraphWidget& _widget; +public: + StapParser(Gtk::Window& win, + GraphWidget& widget) : _win(win), _widget(widget) {} + + bool ioCallback(Glib::IOCondition ioCondition) + { + if ((ioCondition & Glib::IO_IN) == 0) + return true; + char buf[256]; + ssize_t bytes_read = 0; + bytes_read = read(0, buf, sizeof(buf) - 1); + if (bytes_read <= 0) + { + _win.hide(); + return true; + } + buf[bytes_read] = '\0'; + _buffer += buf; + Glib::ustring::size_type ret = Glib::ustring::npos; + while ((ret = _buffer.find('\n')) != Glib::ustring::npos) + { + Glib::ustring dataString(_buffer, 0, ret); + if (dataString[0] == '%') + { + size_t found; + if ((found = dataString.find("%Title:") == 0)) + { + std::string title = dataString.substr(7); + _widget.setTitle(title); + } + else if ((found = dataString.find("%XAxisTitle:") == 0)) + { + _widget.setXAxisText(dataString.substr(12)); + } + else if ((found = dataString.find("%YAxisTitle:") == 0)) + { + _widget.setYAxisText(dataString.substr(12)); + } + else if ((found = dataString.find("%YMax:") == 0)) + { + double ymax; + std::istringstream stream(dataString.substr(6)); + stream >> ymax; + // _gdata->scale = ymax; + } + else if ((found = dataString.find("%DataSet:") == 0)) + { + std::tr1::shared_ptr<GraphData> dataSet(new GraphData); + std::string setName; + int hexColor; + std::string style; + std::istringstream stream(dataString.substr(9)); + stream >> setName >> dataSet->scale >> std::hex >> hexColor + >> style; + dataSet->color[0] = (hexColor >> 16) / 255.0; + dataSet->color[1] = ((hexColor >> 8) & 0xff) / 255.0; + dataSet->color[2] = (hexColor & 0xff) / 255.0; + if (style == "dot") + dataSet->style = GraphData::DOT; + _dataSets.insert(std::make_pair(setName, dataSet)); + _widget.addGraphData(dataSet); + } + } + else + { + std::string dataSet; + double time; + double data; + std::istringstream stream(dataString); + stream >> dataSet >> time >> data; + DataMap::iterator itr = _dataSets.find(dataSet); + if (itr != _dataSets.end()) + itr->second->data.push_back(std::make_pair(time, data)); + } + _buffer.erase(0, ret + 1); + } + return true; + } +}; + +int main(int argc, char** argv) +{ + Gtk::Main app(argc, argv); + + Gtk::Window win; + + win.set_title("Grapher"); + win.set_default_size(600, 200); + + GraphWidget w; + + w.setExtents(0.0, 1.0, 5.0, 0.0); + w.setLineWidth(2); + + StapParser stapParser(win, w); + Glib::signal_io().connect(sigc::mem_fun(stapParser, + &StapParser::ioCallback), + 0, + Glib::IO_IN); + win.add(w); + w.show(); + + Gtk::Main::run(win); + + return 0; +} diff --git a/testsuite/systemtap.examples/general/grapher.stp b/testsuite/systemtap.examples/general/grapher.stp new file mode 100644 index 00000000..04463979 --- /dev/null +++ b/testsuite/systemtap.examples/general/grapher.stp @@ -0,0 +1,32 @@ +#! /usr/bin/stap + +probe begin +{ +printf ("%s\n", "%Title:CPU utilization"); +printf ("%s\n", "%XAxisTitle:Time"); +printf ("%s\n", "%YAxisTitle:Percent"); +printf ("%s\n", "%DataSet:cpu 100 00ff00 bar"); +printf ("%s\n", "%DataSet:kbd 100 ff0000 dot"); +} + +# CPU utilization +probe begin { qnames["cpu"] ++; qsq_start ("cpu") } +probe scheduler.cpu_on { if (!idle) {qs_wait ("cpu") qs_run ("cpu") }} +probe scheduler.cpu_off { if (!idle) qs_done ("cpu") } + +global qnames + +function qsq_util_reset(q) { + u=qsq_utilization (q, 100) + qsq_start (q) + return u +} + +probe timer.ms(100) { # collect utilization percentages frequently + foreach (q in qnames) + printf("cpu %d %d\n", gettimeofday_ms(), qsq_util_reset(q)) +} + +probe kernel.function("kbd_event") { + printf("kbd %d %d\n", gettimeofday_ms(), 75) +} |