diff options
author | Tim Moore <timoore@redhat.com> | 2009-12-08 23:17:47 +0100 |
---|---|---|
committer | Tim Moore <timoore@redhat.com> | 2009-12-08 23:34:00 +0100 |
commit | 8cabc8bcdcd22e8726734f1a18f23ed7d9c19e9f (patch) | |
tree | 5cc6fc14a7b51859a0bf181c10d08b5d75fff03f /grapher/StapParser.hxx | |
parent | cfd482078cd4805076cc6fd7e4e8642b97a03b25 (diff) | |
download | systemtap-steved-8cabc8bcdcd22e8726734f1a18f23ed7d9c19e9f.tar.gz systemtap-steved-8cabc8bcdcd22e8726734f1a18f23ed7d9c19e9f.tar.xz systemtap-steved-8cabc8bcdcd22e8726734f1a18f23ed7d9c19e9f.zip |
grapher: start of a dialog for displaying active stap processes
The names of active scripts are displayed in a list; mock buttons
suggest being able to stop and restart them.
* grapher/processwindow.glade: new file
* grapher/Makefile.am: add processwindow.glade to installed files
* grapher/StapParser.hxx (StapProcess): new class
(StapParser): factor out members that are now in StapProcess
(ioCallback): Use the new childDied signal instead of aborting the
whole grapher when a child dies.
* grapher/grapher.cxx (ProcModelColumns, ProcWindow): classes for
displaying stap process window.
(GrapherWindow::on_menu_proc_window): new function
Diffstat (limited to 'grapher/StapParser.hxx')
-rw-r--r-- | grapher/StapParser.hxx | 77 |
1 files changed, 54 insertions, 23 deletions
diff --git a/grapher/StapParser.hxx b/grapher/StapParser.hxx index eba8a7af..cfb807a8 100644 --- a/grapher/StapParser.hxx +++ b/grapher/StapParser.hxx @@ -9,30 +9,61 @@ #include "GraphData.hxx" #include <string> +#include <tr1/memory> + +#include <unistd.h> + namespace systemtap { -class StapParser -{ - std::string _buffer; - typedef std::map<std::string, std::tr1::shared_ptr<GraphDataBase> > DataMap; - DataMap _dataSets; - CSVData _csv; - Gtk::Window* _win; - int _errFd; - int _inFd; - unsigned char _lineEndChar; -public: - StapParser(Gtk::Window* win) - : _win(win), _errFd(-1), _inFd(-1), _lineEndChar('\n') + // arguments and script for a stap process + struct StapProcess { - } - void parseData(std::tr1::shared_ptr<GraphDataBase> gdata, - int64_t time, const std::string& dataString); - bool ioCallback(Glib::IOCondition ioCondition); - bool errIoCallback(Glib::IOCondition ioCondition); - int getErrFd() { return _errFd; } - void setErrFd(int fd) { _errFd = fd; } - int getInFd() { return _inFd; } - void setInFd(int fd) { _inFd = fd; } -}; + StapProcess(pid_t pid_ = -1) : pid(pid_) {} + std::string stapArgs; + std::string script; + std::string scriptArgs; + // arguments passed from a single array, like from the command line. + char **argv; + // -1 if the grapher is reading from stdin + pid_t pid; + }; + + class StapParser + { + std::string _buffer; + typedef std::map<std::string, std::tr1::shared_ptr<GraphDataBase> > DataMap; + DataMap _dataSets; + CSVData _csv; + int _errFd; + int _inFd; + unsigned char _lineEndChar; + std::tr1::shared_ptr<StapProcess> _process; + public: + StapParser() + : _errFd(-1), _inFd(-1), _lineEndChar('\n') + { + } + void parseData(std::tr1::shared_ptr<GraphDataBase> gdata, + int64_t time, const std::string& dataString); + bool ioCallback(Glib::IOCondition ioCondition); + bool errIoCallback(Glib::IOCondition ioCondition); + int getErrFd() const { return _errFd; } + void setErrFd(int fd) { _errFd = fd; } + int getInFd() const { return _inFd; } + void setInFd(int fd) { _inFd = fd; } + pid_t getPid() const + { + if (_process) + return _process->pid; + else + return -1; + } + std::tr1::shared_ptr<StapProcess> getProcess() { return _process; } + void setProcess(std::tr1::shared_ptr<StapProcess> process) + { + _process = process; + } + }; + + sigc::signal<void, pid_t>& childDiedSignal(); } |