summaryrefslogtreecommitdiffstats
path: root/grapher
diff options
context:
space:
mode:
Diffstat (limited to 'grapher')
-rw-r--r--grapher/Graph.cxx262
-rw-r--r--grapher/Graph.hxx48
-rw-r--r--grapher/GraphData.hxx4
-rw-r--r--grapher/GraphWidget.cxx294
-rw-r--r--grapher/GraphWidget.hxx36
-rw-r--r--grapher/Makefile.am2
-rw-r--r--grapher/Makefile.in151
-rw-r--r--grapher/StapParser.cxx248
-rw-r--r--grapher/grapher.cxx3
9 files changed, 616 insertions, 432 deletions
diff --git a/grapher/Graph.cxx b/grapher/Graph.cxx
new file mode 100644
index 00000000..1fa598c2
--- /dev/null
+++ b/grapher/Graph.cxx
@@ -0,0 +1,262 @@
+#include "Graph.hxx"
+
+#include <sstream>
+#include <iostream>
+#include <iomanip>
+
+namespace systemtap
+{
+ using namespace std;
+ using namespace std::tr1;
+
+ Graph::Graph()
+ : _left(0.0), _right(1.0), _top(5.0), _bottom(0.0), _lineWidth(2),
+ _autoScaling(true), _autoScrolling(true), _zoomFactor(1.0),
+ _playButton(new CairoPlayButton)
+ {
+ }
+
+
+ void Graph::draw(Cairo::RefPtr<Cairo::Context> cr)
+ {
+
+ if (_autoScaling)
+ {
+ // line separation
+ int linesPossible = _graphWidth / (_lineWidth + 2);
+ // Find latest time.
+ double latestTime = 0;
+ for (DatasetList::iterator ditr = _datasets.begin(),
+ de = _datasets.end();
+ ditr != de;
+ ++ditr)
+ {
+ if (!(*ditr)->times.empty())
+ {
+ double lastDataTime = (*ditr)->times.back();
+ 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)
+ {
+ GraphDataBase::TimeList& gtimes = (*ditr)->times;
+ if (gtimes.size() <= 1)
+ continue;
+ double totalDiff = 0.0;
+ for (GraphDataBase::TimeList::reverse_iterator ritr = gtimes.rbegin(),
+ re = gtimes.rend();
+ ritr + 1 != gtimes.rend();
+ ritr++)
+ {
+ double timeDiff = *ritr - *(ritr + 1);
+ 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 * _graphWidth / ( _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)
+ {
+ shared_ptr<GraphDataBase> graphData = *itr;
+ shared_ptr<GraphData<double> > realData
+ = dynamic_pointer_cast<GraphData<double> >(*itr);
+ shared_ptr<GraphData<string> > stringData
+ = dynamic_pointer_cast<GraphData<string> >(*itr);
+ cr->save();
+ cr->translate(0.0, _graphHeight);
+ cr->scale(1.0, -1.0);
+ GraphDataBase::TimeList::iterator lower
+ = std::lower_bound(graphData->times.begin(), graphData->times.end(),
+ _left);
+ GraphDataBase::TimeList::iterator upper
+ = std::upper_bound(graphData->times.begin(), graphData->times.end(),
+ _right);
+ // event bar
+ if (graphData->style == GraphDataBase::EVENT)
+ {
+ double eventHeight = _graphHeight * (graphData->scale / 100.0);
+ cr->save();
+ cr->set_line_width(3 * _lineWidth);
+ cr->set_source_rgba(graphData->color[0], graphData->color[1],
+ graphData->color[2], .33);
+ cr->move_to(0, eventHeight);
+ cr->line_to(_graphWidth, eventHeight);
+ cr->stroke();
+ cr->restore();
+ }
+ for (GraphDataBase::TimeList::iterator ditr = lower, de = upper;
+ ditr != de;
+ ++ditr)
+ {
+ size_t dataIndex = ditr - graphData->times.begin();
+ cr->set_source_rgba(graphData->color[0], graphData->color[1],
+ graphData->color[2], 1.0);
+ if (graphData->style == GraphDataBase::BAR && realData)
+ {
+ cr->move_to((*ditr - _left) * horizScale, 0);
+ cr->line_to((*ditr - _left) * horizScale,
+ realData->data[dataIndex] * _graphHeight
+ / graphData->scale);
+ cr->stroke();
+ }
+ else if (graphData->style == GraphDataBase::DOT && realData)
+ {
+ cr->arc((*ditr - _left) * horizScale,
+ realData->data[dataIndex] * _graphHeight / graphData->scale,
+ _lineWidth / 2.0, 0.0, M_PI * 2.0);
+ cr->fill();
+ }
+ else if (graphData->style == GraphDataBase::EVENT && stringData)
+ {
+ double eventHeight = _graphHeight * (graphData->scale / 100.0);
+ cr->save();
+ cr->select_font_face("Sans", Cairo::FONT_SLANT_NORMAL,
+ Cairo::FONT_WEIGHT_NORMAL);
+ cr->set_font_size(12.0);
+ cr->save();
+ cr->scale(1.0, -1.0);
+ cr->move_to((*ditr - _left) * horizScale,
+ -eventHeight -3.0 * _lineWidth - 2.0);
+ cr->show_text(stringData->data[dataIndex]);
+ cr->restore();
+ cr->rectangle((*ditr - _left) * horizScale - 1.5 * _lineWidth,
+ eventHeight - 1.5 * _lineWidth,
+ 3.0 * _lineWidth, 3.0 * _lineWidth);
+ 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 (!graphData->title.empty())
+ {
+ cr->move_to(20.0, 20.0);
+ cr->show_text(graphData->title);
+ }
+ if (!graphData->xAxisText.empty())
+ {
+ cr->move_to(10.0, _graphHeight - 5);
+ cr->show_text(graphData->xAxisText);
+ }
+ if (!graphData->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(graphData->yAxisText);
+ cr->restore();
+ }
+ cr->restore();
+
+ }
+ cr->restore();
+ // Draw axes
+ double diff = _right - _left;
+ double majorUnit = pow(10.0, floor(log(diff) / log(10.0)));
+ double startTime = ceil(_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, _graphHeight);
+ cr->line_to(_graphWidth, _graphHeight);
+ cr->stroke();
+ std::valarray<double> dash(1);
+ dash[0] = _graphHeight / 10;
+ cr->set_dash(dash, 0);
+ double prevTextAdvance = 0;
+ for (double tickVal = startTime; tickVal <= _right; tickVal += majorUnit)
+ {
+ double x = (tickVal - _left) * horizScale + 20.0;
+ cr->move_to(x, 0.0);
+ cr->line_to(x, _graphHeight);
+ cr->move_to(x, _graphHeight - 5);
+ std::ostringstream stream;
+ stream << std::fixed << std::setprecision(0) << tickVal;
+ Cairo::TextExtents extents;
+ cr->get_text_extents(stream.str(), extents);
+ // Room for this label?
+ if (x + extents.x_bearing > prevTextAdvance)
+ {
+ cr->show_text(stream.str());
+ prevTextAdvance = x + extents.x_advance;
+ }
+ }
+ cr->stroke();
+ cr->restore();
+
+ if (!_autoScrolling)
+ {
+ _playButton->setVisible(true);
+ _playButton->setOrigin(_graphWidth / 2 - 25, .875 * _graphHeight - 50);
+ _playButton->draw(cr);
+ }
+
+ }
+
+ void Graph::addGraphData(std::tr1::shared_ptr<GraphDataBase> data)
+ {
+ _datasets.push_back(data);
+ }
+
+ void Graph::getExtents(double& left, double& right, double& top,
+ double& bottom) const
+ {
+ left = _left;
+ right = _right;
+ top = _top;
+ bottom = _bottom;
+ }
+
+ void Graph::setExtents(double left, double right, double top, double bottom)
+ {
+ _left = left;
+ _right = right;
+ _top = top;
+ _bottom = bottom;
+ }
+
+ bool Graph::containsPoint(double x, double y)
+ {
+ return x >= _x0 && x < _x0 + _width && y >= _y0 && y < _y0 + _height;
+ }
+}
diff --git a/grapher/Graph.hxx b/grapher/Graph.hxx
new file mode 100644
index 00000000..1cc1892d
--- /dev/null
+++ b/grapher/Graph.hxx
@@ -0,0 +1,48 @@
+#ifndef SYSTEMTAP_GRAPH_HXX
+#define SYSTEMTAP_GRAPH_HXX 1
+
+#include <cairomm/context.h>
+
+#include "GraphData.hxx"
+#include "CairoWidget.hxx"
+
+namespace systemtap
+{
+ class Graph : public CairoWidget
+ {
+ public:
+ friend class GraphWidget;
+ Graph();
+ virtual void draw(Cairo::RefPtr<Cairo::Context> cr);
+ virtual bool containsPoint(double x, double y);
+ double getLineWidth() { return _lineWidth; }
+ void setLineWidth(double lineWidth) { _lineWidth = lineWidth; }
+ bool getAutoScaling() const { return _autoScaling; }
+ void setAutoScaling(bool val) { _autoScaling = val; }
+ void addGraphData(std::tr1::shared_ptr<GraphDataBase> data);
+ void getExtents(double& left, double& right, double& top, double& bottom)
+ const;
+ void setExtents(double left, double right, double top, double bottom);
+ // extents of the whole graph area
+ double _width;
+ double _height;
+ // Position, extents of the graph
+ double _graphX;
+ double _graphY;
+ double _graphWidth;
+ double _graphHeight;
+ double _lineWidth;
+ bool _autoScaling;
+ bool _autoScrolling;
+ double _zoomFactor;
+ std::tr1::shared_ptr<CairoPlayButton> _playButton;
+ protected:
+ typedef std::vector<std::tr1::shared_ptr<GraphDataBase> > DatasetList;
+ DatasetList _datasets;
+ double _left;
+ double _right;
+ double _top;
+ double _bottom;
+ };
+}
+#endif
diff --git a/grapher/GraphData.hxx b/grapher/GraphData.hxx
index 9bf3b624..e4c08cfd 100644
--- a/grapher/GraphData.hxx
+++ b/grapher/GraphData.hxx
@@ -1,6 +1,7 @@
#ifndef SYSTEMTAP_GRAPHDATA_HXX
#define SYSTEMTAP_GRAPHDATA_HXX 1
+#include <string>
#include <utility>
#include <vector>
#include <tr1/memory>
@@ -24,6 +25,9 @@ namespace systemtap
double scale;
double color[3];
Style style;
+ std::string title;
+ std::string xAxisText;
+ std::string yAxisText;
TimeList times;
};
diff --git a/grapher/GraphWidget.cxx b/grapher/GraphWidget.cxx
index d62ec4f3..5b0d1b1c 100644
--- a/grapher/GraphWidget.cxx
+++ b/grapher/GraphWidget.cxx
@@ -1,21 +1,18 @@
#include <algorithm>
#include <ctime>
#include <math.h>
-#include <sstream>
-#include <iostream>
-#include <iomanip>
+
#include <cairomm/context.h>
#include "GraphWidget.hxx"
#include "CairoWidget.hxx"
namespace systemtap
{
- using std::string;
+ using namespace std;
+ using namespace std::tr1;
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)
+ : _trackingDrag(false)
{
add_events(Gdk::POINTER_MOTION_MASK | Gdk::BUTTON_PRESS_MASK
| Gdk::BUTTON_RELEASE_MASK | Gdk::SCROLL_MASK);
@@ -34,33 +31,20 @@ namespace systemtap
false);
signal_scroll_event()
.connect(sigc::mem_fun(*this, &GraphWidget::on_scroll_event), false);
+ // Temporary testing of multiple graphs
+ shared_ptr<Graph> graph(new Graph);
+ graph->_graphHeight = 180;
+ graph->_graphWidth = 580;
+ _graphs.push_back(graph);
}
- 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<GraphDataBase> data)
{
- _datasets.push_back(data);
+ _graphs[0]->addGraphData(data);
}
bool GraphWidget::on_expose_event(GdkEventExpose* event)
@@ -78,6 +62,7 @@ namespace systemtap
const int height = graphHeight - 20;
Cairo::RefPtr<Cairo::Context> cr = window->create_cairo_context();
+#if 0
if(event && !_autoScaling)
{
// clip to the area indicated by the expose event so that we only
@@ -86,233 +71,51 @@ namespace systemtap
event->area.width, event->area.height);
cr->clip();
}
- if (_autoScaling)
- {
- // line separation
- int linesPossible = width / ((int)_lineWidth + 2);
- // Find latest time.
- double latestTime = 0;
- for (DatasetList::iterator ditr = _datasets.begin(),
- de = _datasets.end();
- ditr != de;
- ++ditr)
- {
- if (!(*ditr)->times.empty())
- {
- double lastDataTime = (*ditr)->times.back();
- 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)
- {
- GraphDataBase::TimeList& gtimes = (*ditr)->times;
- if (gtimes.size() <= 1)
- continue;
- double totalDiff = 0.0;
- for (GraphDataBase::TimeList::reverse_iterator ritr = gtimes.rbegin(),
- re = gtimes.rend();
- ritr + 1 != gtimes.rend();
- ritr++)
- {
- double timeDiff = *ritr - *(ritr + 1);
- 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);
+#endif
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)
- {
- std::tr1::shared_ptr<GraphData<double> > realData
- = std::tr1::dynamic_pointer_cast<GraphData<double> >(*itr);
- std::tr1::shared_ptr<GraphData<string> > stringData
- = std::tr1::dynamic_pointer_cast<GraphData<string> >(*itr);
- cr->save();
- cr->translate(0.0, height);
- cr->scale(1.0, -1.0);
- GraphDataBase::TimeList::iterator lower
- = std::lower_bound((*itr)->times.begin(), (*itr)->times.end(), _left);
- GraphDataBase::TimeList::iterator upper
- = std::upper_bound((*itr)->times.begin(), (*itr)->times.end(),
- _right);
- // event bar
- if ((*itr)->style == GraphDataBase::EVENT)
- {
- double eventHeight = height * ((*itr)->scale / 100.0);
- cr->save();
- cr->set_line_width(3 * _lineWidth);
- cr->set_source_rgba((*itr)->color[0], (*itr)->color[1],
- (*itr)->color[2], .33);
- cr->move_to(0, eventHeight);
- cr->line_to(width, eventHeight);
- cr->stroke();
- cr->restore();
- }
- for (GraphDataBase::TimeList::iterator ditr = lower, de = upper;
- ditr != de;
- ++ditr)
- {
- size_t dataIndex = ditr - (*itr)->times.begin();
- cr->set_source_rgba((*itr)->color[0], (*itr)->color[1],
- (*itr)->color[2], 1.0);
- if ((*itr)->style == GraphDataBase::BAR && realData)
- {
- cr->move_to((*ditr - _left) * horizScale, 0);
- cr->line_to((*ditr - _left) * horizScale,
- realData->data[dataIndex] * height / (*itr)->scale);
- cr->stroke();
- }
- else if ((*itr)->style == GraphDataBase::DOT && realData)
- {
- cr->arc((*ditr - _left) * horizScale,
- realData->data[dataIndex] * height / (*itr)->scale,
- _lineWidth / 2.0, 0.0, M_PI * 2.0);
- cr->fill();
- }
- else if ((*itr)->style == GraphDataBase::EVENT && stringData)
- {
- double eventHeight = height * ((*itr)->scale / 100.0);
- cr->save();
- cr->select_font_face("Sans", Cairo::FONT_SLANT_NORMAL,
- Cairo::FONT_WEIGHT_NORMAL);
- cr->set_font_size(12.0);
- cr->save();
- cr->scale(1.0, -1.0);
- cr->move_to((*ditr - _left) * horizScale,
- -eventHeight -3.0 * _lineWidth - 2.0);
- cr->show_text(stringData->data[dataIndex]);
- cr->restore();
- cr->rectangle((*ditr - _left) * horizScale - 1.5 * _lineWidth,
- eventHeight - 1.5 * _lineWidth,
- 3.0 * _lineWidth, 3.0 * _lineWidth);
- cr->fill();
- cr->restore();
- }
- }
- 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())
+ for (GraphList::iterator g = _graphs.begin(); g != _graphs.end(); ++g)
{
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->translate((*g)->_graphX, (*g)->_graphY);
+ (*g)->draw(cr);
cr->restore();
}
- cr->restore();
- // Draw axes
- double diff = _right - _left;
- double majorUnit = pow(10.0, floor(log(diff) / log(10.0)));
- double startTime = ceil(_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::valarray<double> dash(1);
- dash[0] = height / 10;
- cr->set_dash(dash, 0.0);
- double prevTextAdvance = 0;
- for (double tickVal = startTime; tickVal <= _right; tickVal += majorUnit)
- {
- double x = (tickVal - _left) * horizScale + 20.0;
- cr->move_to(x, 0.0);
- cr->line_to(x, height);
- cr->move_to(x, graphHeight - 5);
- std::ostringstream stream;
- stream << std::fixed << std::setprecision(0) << tickVal;
- Cairo::TextExtents extents;
- cr->get_text_extents(stream.str(), extents);
- // Room for this label?
- if (x + extents.x_bearing > prevTextAdvance)
- {
- cr->show_text(stream.str());
- prevTextAdvance = x + extents.x_advance;
- }
- }
- 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))
+ for (GraphList::iterator g = _graphs.begin(); g != _graphs.end(); ++g)
+ {
+ if (event->x >= (*g)->_graphX
+ && event->x < (*g)->_graphX + (*g)->_graphWidth
+ && event->y >= (*g)->_graphY
+ && event->y < (*g)->_graphY + (*g)->_graphHeight)
+ {
+ _activeGraph = *g;
+ break;
+ }
+ }
+ if (!_activeGraph)
+ return true;
+ if (!_activeGraph->_autoScrolling
+ && _activeGraph->_playButton->containsPoint(event->x, event->y))
{
- _autoScaling = true;
- _autoScrolling = true;
+ _activeGraph->_autoScaling = true;
+ _activeGraph->_autoScrolling = true;
queue_draw();
}
else
{
_trackingDrag = true;
- _autoScaling = false;
- _autoScrolling = false;
+ _activeGraph->_autoScaling = false;
+ _activeGraph->_autoScrolling = false;
_dragOriginX = event->x;
_dragOriginY = event->y;
- _dragOrigLeft = _left;
- _dragOrigRight = _right;
+ _dragOrigLeft = _activeGraph->_left;
+ _dragOrigRight = _activeGraph->_right;
}
return true;
}
@@ -339,14 +142,14 @@ namespace systemtap
x = event->x;
y = event->y;
}
- if (_trackingDrag)
+ if (_trackingDrag && _activeGraph)
{
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;
+ _activeGraph->_left = _dragOrigLeft + increment;
+ _activeGraph->_right = _dragOrigRight + increment;
queue_draw();
}
return true;
@@ -354,11 +157,20 @@ namespace systemtap
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();
+ for (GraphList::iterator gitr = _graphs.begin();
+ gitr != _graphs.end();
+ ++gitr)
+ {
+ if ((*gitr)->containsPoint(event->x, event->y))
+ {
+ if (event->direction == GDK_SCROLL_UP)
+ (*gitr)->_zoomFactor += .1;
+ else if (event->direction == GDK_SCROLL_DOWN)
+ (*gitr)->_zoomFactor -= .1;
+ queue_draw();
+ break;
+ }
+ }
return true;
}
diff --git a/grapher/GraphWidget.hxx b/grapher/GraphWidget.hxx
index 86ba771d..c15f8fcd 100644
--- a/grapher/GraphWidget.hxx
+++ b/grapher/GraphWidget.hxx
@@ -6,7 +6,7 @@
#include <tr1/memory>
#include <gtkmm/drawingarea.h>
-#include "GraphData.hxx"
+#include <Graph.hxx>
namespace systemtap
{
@@ -18,19 +18,15 @@ namespace systemtap
GraphWidget();
virtual ~GraphWidget();
void addGraphData(std::tr1::shared_ptr<GraphDataBase> 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:
+ typedef std::vector<std::tr1::shared_ptr<Graph> > GraphList;
+ GraphList _graphs;
+ // For click and drag
+ std::tr1::shared_ptr<Graph> _activeGraph;
+ // Dragging all graphs simultaneously, or perhaps seperately
+ typedef std::vector<std::pair<double, double> > DragList;
+ DragList dragCoords;
//Override default signal handler:
virtual bool on_expose_event(GdkEventExpose* event);
virtual bool on_motion_notify_event(GdkEventMotion* event);
@@ -38,25 +34,11 @@ namespace systemtap
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<GraphDataBase> > 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/grapher/Makefile.am b/grapher/Makefile.am
index bd651352..0f61d77b 100644
--- a/grapher/Makefile.am
+++ b/grapher/Makefile.am
@@ -2,6 +2,6 @@ if BUILD_GRAPHER
bin_PROGRAMS = grapher
grapher_CXXFLAGS = $(GRAPHER_CFLAGS)
-grapher_SOURCES = grapher.cxx StapParser.cxx GraphWidget.cxx CairoWidget.cxx
+grapher_SOURCES = grapher.cxx StapParser.cxx Graph.cxx GraphWidget.cxx CairoWidget.cxx
grapher_LDADD = $(GRAPHER_LIBS)
endif \ No newline at end of file
diff --git a/grapher/Makefile.in b/grapher/Makefile.in
index 3e65401e..227359be 100644
--- a/grapher/Makefile.in
+++ b/grapher/Makefile.in
@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.10.2 from Makefile.am.
+# Makefile.in generated by automake 1.11 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -16,8 +17,9 @@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
@@ -40,13 +42,14 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
am__installdirs = "$(DESTDIR)$(bindir)"
-binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
PROGRAMS = $(bin_PROGRAMS)
-am__grapher_SOURCES_DIST = grapher.cxx StapParser.cxx GraphWidget.cxx \
- CairoWidget.cxx
+am__grapher_SOURCES_DIST = grapher.cxx StapParser.cxx Graph.cxx \
+ GraphWidget.cxx CairoWidget.cxx
@BUILD_GRAPHER_TRUE@am_grapher_OBJECTS = grapher-grapher.$(OBJEXT) \
@BUILD_GRAPHER_TRUE@ grapher-StapParser.$(OBJEXT) \
+@BUILD_GRAPHER_TRUE@ grapher-Graph.$(OBJEXT) \
@BUILD_GRAPHER_TRUE@ grapher-GraphWidget.$(OBJEXT) \
@BUILD_GRAPHER_TRUE@ grapher-CairoWidget.$(OBJEXT)
grapher_OBJECTS = $(am_grapher_OBJECTS)
@@ -57,6 +60,7 @@ grapher_LINK = $(CXXLD) $(grapher_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
+am__mv = mv -f
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
CXXLD = $(CXX)
@@ -186,7 +190,7 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
@BUILD_GRAPHER_TRUE@grapher_CXXFLAGS = $(GRAPHER_CFLAGS)
-@BUILD_GRAPHER_TRUE@grapher_SOURCES = grapher.cxx StapParser.cxx GraphWidget.cxx CairoWidget.cxx
+@BUILD_GRAPHER_TRUE@grapher_SOURCES = grapher.cxx StapParser.cxx Graph.cxx GraphWidget.cxx CairoWidget.cxx
@BUILD_GRAPHER_TRUE@grapher_LDADD = $(GRAPHER_LIBS)
all: all-am
@@ -201,9 +205,9 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu grapher/Makefile'; \
- cd $(top_srcdir) && \
- $(AUTOMAKE) --gnu grapher/Makefile
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu grapher/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu grapher/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -221,26 +225,41 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
- @list='$(bin_PROGRAMS)'; for p in $$list; do \
- p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
- if test -f $$p \
- ; then \
- f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
- echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
- $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \
- else :; fi; \
- done
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
uninstall-binPROGRAMS:
@$(NORMAL_UNINSTALL)
- @list='$(bin_PROGRAMS)'; for p in $$list; do \
- f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
- echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \
- rm -f "$(DESTDIR)$(bindir)/$$f"; \
- done
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
clean-binPROGRAMS:
-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
@@ -255,76 +274,91 @@ 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-Graph.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/grapher-GraphWidget.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/grapher-StapParser.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/grapher-grapher.Po@am__quote@
.cxx.o:
@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@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@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@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) '$<'`
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
+@am__fastdepCXX_TRUE@ $(am__mv) $(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
+@am__fastdepCXX_TRUE@ $(am__mv) $(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-StapParser.o: StapParser.cxx
@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(grapher_CXXFLAGS) $(CXXFLAGS) -MT grapher-StapParser.o -MD -MP -MF $(DEPDIR)/grapher-StapParser.Tpo -c -o grapher-StapParser.o `test -f 'StapParser.cxx' || echo '$(srcdir)/'`StapParser.cxx
-@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/grapher-StapParser.Tpo $(DEPDIR)/grapher-StapParser.Po
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/grapher-StapParser.Tpo $(DEPDIR)/grapher-StapParser.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='StapParser.cxx' object='grapher-StapParser.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-StapParser.o `test -f 'StapParser.cxx' || echo '$(srcdir)/'`StapParser.cxx
grapher-StapParser.obj: StapParser.cxx
@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(grapher_CXXFLAGS) $(CXXFLAGS) -MT grapher-StapParser.obj -MD -MP -MF $(DEPDIR)/grapher-StapParser.Tpo -c -o grapher-StapParser.obj `if test -f 'StapParser.cxx'; then $(CYGPATH_W) 'StapParser.cxx'; else $(CYGPATH_W) '$(srcdir)/StapParser.cxx'; fi`
-@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/grapher-StapParser.Tpo $(DEPDIR)/grapher-StapParser.Po
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/grapher-StapParser.Tpo $(DEPDIR)/grapher-StapParser.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='StapParser.cxx' object='grapher-StapParser.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-StapParser.obj `if test -f 'StapParser.cxx'; then $(CYGPATH_W) 'StapParser.cxx'; else $(CYGPATH_W) '$(srcdir)/StapParser.cxx'; fi`
+grapher-Graph.o: Graph.cxx
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(grapher_CXXFLAGS) $(CXXFLAGS) -MT grapher-Graph.o -MD -MP -MF $(DEPDIR)/grapher-Graph.Tpo -c -o grapher-Graph.o `test -f 'Graph.cxx' || echo '$(srcdir)/'`Graph.cxx
+@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/grapher-Graph.Tpo $(DEPDIR)/grapher-Graph.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Graph.cxx' object='grapher-Graph.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-Graph.o `test -f 'Graph.cxx' || echo '$(srcdir)/'`Graph.cxx
+
+grapher-Graph.obj: Graph.cxx
+@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(grapher_CXXFLAGS) $(CXXFLAGS) -MT grapher-Graph.obj -MD -MP -MF $(DEPDIR)/grapher-Graph.Tpo -c -o grapher-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)/grapher-Graph.Tpo $(DEPDIR)/grapher-Graph.Po
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Graph.cxx' object='grapher-Graph.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-Graph.obj `if test -f 'Graph.cxx'; then $(CYGPATH_W) 'Graph.cxx'; else $(CYGPATH_W) '$(srcdir)/Graph.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
+@am__fastdepCXX_TRUE@ $(am__mv) $(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
+@am__fastdepCXX_TRUE@ $(am__mv) $(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
+@am__fastdepCXX_TRUE@ $(am__mv) $(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
+@am__fastdepCXX_TRUE@ $(am__mv) $(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`
@@ -341,7 +375,7 @@ tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
- tags=; \
+ set x; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
@@ -349,29 +383,34 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
- if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$tags $$unique; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
- tags=; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
- test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$tags $$unique
+ $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
- && cd $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) $$here
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -392,13 +431,17 @@ distdir: $(DISTFILES)
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
- cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
- test -f $(distdir)/$$file \
- || cp -p $$d/$$file $(distdir)/$$file \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
@@ -429,6 +472,7 @@ clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@@ -449,6 +493,8 @@ dvi-am:
html: html-am
+html-am:
+
info: info-am
info-am:
@@ -457,18 +503,28 @@ install-data-am:
install-dvi: install-dvi-am
+install-dvi-am:
+
install-exec-am: install-binPROGRAMS
install-html: install-html-am
+install-html-am:
+
install-info: install-info-am
+install-info-am:
+
install-man:
install-pdf: install-pdf-am
+install-pdf-am:
+
install-ps: install-ps-am
+install-ps-am:
+
installcheck-am:
maintainer-clean: maintainer-clean-am
@@ -505,6 +561,7 @@ uninstall-am: uninstall-binPROGRAMS
mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
uninstall-am uninstall-binPROGRAMS
+
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/grapher/StapParser.cxx b/grapher/StapParser.cxx
index 8b72f93b..1c865614 100644
--- a/grapher/StapParser.cxx
+++ b/grapher/StapParser.cxx
@@ -5,7 +5,8 @@
namespace systemtap
{
-using namespace std;
+ using namespace std;
+ using namespace std::tr1;
vector<string> commaSplit(const string& inStr, size_t pos = 0)
{
@@ -28,13 +29,13 @@ vector<string> commaSplit(const string& inStr, size_t pos = 0)
return result;
}
- void StapParser::parseData(std::tr1::shared_ptr<GraphDataBase> gdata,
+ void StapParser::parseData(shared_ptr<GraphDataBase> gdata,
double time, const string& dataString)
{
std::istringstream stream(dataString);
- std::tr1::shared_ptr<GraphData<double> > dblptr;
- std::tr1::shared_ptr<GraphData<string> > strptr;
- dblptr = std::tr1::dynamic_pointer_cast<GraphData<double> >(gdata);
+ shared_ptr<GraphData<double> > dblptr;
+ shared_ptr<GraphData<string> > strptr;
+ dblptr = dynamic_pointer_cast<GraphData<double> >(gdata);
if (dblptr)
{
double data;
@@ -51,132 +52,153 @@ vector<string> commaSplit(const string& inStr, size_t pos = 0)
}
}
-bool StapParser::ioCallback(Glib::IOCondition ioCondition)
-{
- using namespace std;
- 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;
- string::size_type ret = string::npos;
- while ((ret = _buffer.find('\n')) != string::npos)
+ size_t findTaggedValue(const string& src, const char* tag, string& result)
+ {
+ size_t found;
+ if ((found = src.find(tag)) != string::npos)
+ result = src.substr(strlen(tag));
+ return found;
+ }
+
+ bool StapParser::ioCallback(Glib::IOCondition ioCondition)
{
- Glib::ustring dataString(_buffer, 0, ret);
- if (dataString[0] == '%')
+ using namespace std;
+ 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;
+ string::size_type ret = string::npos;
+ while ((ret = _buffer.find('\n')) != string::npos)
{
+ Glib::ustring dataString(_buffer, 0, ret);
+ // %DataSet and %CSV declare a data set; all other statements begin with
+ // the name of a data set.
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))
+ if (dataString[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::string setName;
- int hexColor;
- double scale;
- std::string style;
- std::istringstream stream(dataString.substr(9));
- stream >> setName >> scale >> std::hex >> hexColor
- >> style;
- if (style == "bar" || style == "dot")
+ if ((found = dataString.find("%DataSet:") == 0))
{
- std::tr1::shared_ptr<GraphData<double> >
- dataSet(new GraphData<double>);
- if (style == "dot")
- dataSet->style = GraphDataBase::DOT;
- dataSet->color[0] = (hexColor >> 16) / 255.0;
- dataSet->color[1] = ((hexColor >> 8) & 0xff) / 255.0;
- dataSet->color[2] = (hexColor & 0xff) / 255.0;
- dataSet->scale = scale;
- _dataSets.insert(std::make_pair(setName, dataSet));
- _widget.addGraphData(dataSet);
+ std::string setName;
+ int hexColor;
+ double scale;
+ std::string style;
+ std::istringstream stream(dataString.substr(9));
+ stream >> setName >> scale >> std::hex >> hexColor
+ >> style;
+ if (style == "bar" || style == "dot")
+ {
+ shared_ptr<GraphData<double> >
+ dataSet(new GraphData<double>);
+ if (style == "dot")
+ dataSet->style = GraphDataBase::DOT;
+ dataSet->color[0] = (hexColor >> 16) / 255.0;
+ dataSet->color[1] = ((hexColor >> 8) & 0xff) / 255.0;
+ dataSet->color[2] = (hexColor & 0xff) / 255.0;
+ dataSet->scale = scale;
+ _dataSets.insert(std::make_pair(setName, dataSet));
+ _widget.addGraphData(dataSet);
+ }
+ else if (style == "discreet")
+ {
+ shared_ptr<GraphData<string> >
+ dataSet(new GraphData<string>);
+ dataSet->style = GraphDataBase::EVENT;
+ dataSet->color[0] = (hexColor >> 16) / 255.0;
+ dataSet->color[1] = ((hexColor >> 8) & 0xff) / 255.0;
+ dataSet->color[2] = (hexColor & 0xff) / 255.0;
+ dataSet->scale = scale;
+ _dataSets.insert(std::make_pair(setName, dataSet));
+ _widget.addGraphData(dataSet);
+ }
}
- else if (style == "discreet")
+ else if ((found = dataString.find("%CSV:") == 0))
{
- std::tr1::shared_ptr<GraphData<string> >
- dataSet(new GraphData<string>);
- dataSet->style = GraphDataBase::EVENT;
- dataSet->color[0] = (hexColor >> 16) / 255.0;
- dataSet->color[1] = ((hexColor >> 8) & 0xff) / 255.0;
- dataSet->color[2] = (hexColor & 0xff) / 255.0;
- dataSet->scale = scale;
- _dataSets.insert(std::make_pair(setName, dataSet));
- _widget.addGraphData(dataSet);
+ vector<string> tokens = commaSplit(dataString, found + 5);
+ for (vector<string>::iterator tokIter = tokens.begin(),
+ e = tokens.end();
+ tokIter != e;
+ ++tokIter)
+ {
+ DataMap::iterator setIter = _dataSets.find(*tokIter);
+ if (setIter != _dataSets.end())
+ _csv.elements
+ .push_back(CSVData::Element(*tokIter,
+ setIter->second));
+ }
}
- }
- else if ((found = dataString.find("%CSV:") == 0))
- {
- vector<string> tokens = commaSplit(dataString, found + 5);
- for (vector<string>::iterator tokIter = tokens.begin(),
- e = tokens.end();
- tokIter != e;
- ++tokIter)
+ else
{
- DataMap::iterator setIter = _dataSets.find(*tokIter);
- if (setIter != _dataSets.end())
- _csv.elements
- .push_back(CSVData::Element(*tokIter,
- setIter->second));
- }
- }
- }
- else
- {
- if (!_csv.elements.empty())
- {
- vector<string> tokens = commaSplit(dataString);
- int i = 0;
- double time;
- vector<string>::iterator tokIter = tokens.begin();
- std::istringstream timeStream(*tokIter++);
- timeStream >> time;
- for (vector<string>::iterator e = tokens.end();
- tokIter != e;
- ++tokIter, ++i)
- {
- parseData(_csv.elements[i].second, time, *tokIter);
+ cerr << "Unknown declaration " << dataString << endl;
}
}
else
{
- std::string dataSet;
- double time;
- string data;
std::istringstream stream(dataString);
- stream >> dataSet >> time >> data;
- DataMap::iterator itr = _dataSets.find(dataSet);
+ string setName;
+ stream >> setName;
+ DataMap::iterator itr = _dataSets.find(setName);
if (itr != _dataSets.end())
{
- parseData(itr->second, time, data);
+ shared_ptr<GraphDataBase> gdata = itr->second;
+ string decl;
+ // Hack: scan from the beginning of dataString again
+ if (findTaggedValue(dataString, "%Title", decl)
+ != string::npos)
+ {
+ gdata->title = decl;
+ }
+ else if (findTaggedValue(dataString, "%XAxisTitle:", decl)
+ != string::npos)
+ {
+ gdata->xAxisText = decl;
+ }
+ else if (findTaggedValue(dataString, "%YAxisTitle:", decl)
+ != string::npos)
+ {
+ gdata->yAxisText = decl;
+ }
+ else if ((found = dataString.find("%YMax:")) != string::npos)
+ {
+ double ymax;
+ std::istringstream stream(dataString.substr(found));
+ stream >> ymax;
+ gdata->scale = ymax;
+ }
+
+ if (!_csv.elements.empty())
+ {
+ vector<string> tokens = commaSplit(dataString);
+ int i = 0;
+ double time;
+ vector<string>::iterator tokIter = tokens.begin();
+ std::istringstream timeStream(*tokIter++);
+ timeStream >> time;
+ for (vector<string>::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);
}
- _buffer.erase(0, ret + 1);
+ return true;
}
- return true;
-}
}
diff --git a/grapher/grapher.cxx b/grapher/grapher.cxx
index 26e5b9b2..a0d35017 100644
--- a/grapher/grapher.cxx
+++ b/grapher/grapher.cxx
@@ -40,9 +40,6 @@ GrapherWindow::GrapherWindow()
{
set_title("systemtap grapher");
add(m_Box);
- w.setExtents(0.0, 1.0, 5.0, 0.0);
- w.setLineWidth(2);
-
//Create actions for menus and toolbars: