From e3a546d81cd115d7cd9105fc31ecccecfb48b71d Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Tue, 22 Dec 2009 11:35:38 +0100 Subject: grapher: scroll continuously with time Don't scale graph based on how much data will fit. This didn't work very well and resulted in distracting, weird scale changes. We now assume that scripts output their time (x axis) in milliseconds. * grapher/Graph.hxx (setCurrentTime): New function. * grapher/Graph.cxx (Graph::draw): Assume a fixed default scale of 1 pixel = 5 milliseconds and don't do any autoscaling. * grapher/GraphWidget.cxx (GraphWidget constructor): Set global time base on startup. (on_expose_event): Don't search graphs for earliest time. * grapher/GraphWidget.hxx (_timeBaseInitialized): delete * grapher/Time.hxx: new file; interface to timeval. --- grapher/Time.hxx | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 grapher/Time.hxx (limited to 'grapher/Time.hxx') diff --git a/grapher/Time.hxx b/grapher/Time.hxx new file mode 100644 index 00000000..7e16b7b2 --- /dev/null +++ b/grapher/Time.hxx @@ -0,0 +1,83 @@ +// systemtap grapher +// Copyright (C) 2009 Red Hat Inc. +// +// This file is part of systemtap, and is free software. You can +// redistribute it and/or modify it under the terms of the GNU General +// Public License (GPL); either version 2, or (at your option) any +// later version. + +#ifndef SYSTEMTAP_GRAPHER_TIME_HXX +#define SYSTEMTAP_GRAPHER_TIME_HXX 1 + +#include +#include + +namespace systemtap +{ + +template +class Singleton +{ +public: + static T& instance() + { + static T _instance; + return _instance; + } +protected: + Singleton() {} +private: + // Insure that singleton is constructed before main() is called. + struct InstanceBuilder + { + InstanceBuilder() + { + instance(); + } + }; + static InstanceBuilder _instanceBuilder; +}; + +template +typename Singleton::InstanceBuilder Singleton::_instanceBuilder; + +class Time : public Singleton