Panda3D
 All Classes Functions Variables Enumerations
gtkStatsMonitor.cxx
1 // Filename: gtkStatsMonitor.cxx
2 // Created by: drose (16Jan06)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #include "gtkStatsMonitor.h"
16 #include "gtkStats.h"
17 #include "gtkStatsServer.h"
18 #include "gtkStatsStripChart.h"
19 #include "gtkStatsChartMenu.h"
20 #include "gtkStatsPianoRoll.h"
21 #include "gtkStatsMenuId.h"
22 #include "pStatGraph.h"
23 #include "pStatCollectorDef.h"
24 #include "indent.h"
25 
26 typedef void vc();
27 
28 GtkItemFactoryEntry GtkStatsMonitor::menu_entries[] = {
29  { (gchar *)"/Options", NULL, NULL, 0, (gchar *)"<Branch>" },
30  { (gchar *)"/Options/Units", NULL, NULL, 0, (gchar *)"<Branch>" },
31  { (gchar *)"/Options/Units/ms", NULL, (vc *)&handle_menu_command, MI_time_ms, (gchar *)"<RadioItem>" },
32  { (gchar *)"/Options/Units/Hz", NULL, (vc *)&handle_menu_command, MI_time_hz, (gchar *)"/Options/Units/ms" },
33  { (gchar *)"/Speed", NULL, NULL, 0, (gchar *)"<Branch>" },
34  { (gchar *)"/Speed/1", NULL, (vc *)&handle_menu_command, MI_speed_1, (gchar *)"<RadioItem>" },
35  { (gchar *)"/Speed/2", NULL, (vc *)&handle_menu_command, MI_speed_2, (gchar *)"/Speed/1" },
36  { (gchar *)"/Speed/3", NULL, (vc *)&handle_menu_command, MI_speed_3, (gchar *)"/Speed/1" },
37  { (gchar *)"/Speed/6", NULL, (vc *)&handle_menu_command, MI_speed_6, (gchar *)"/Speed/1" },
38  { (gchar *)"/Speed/12", NULL, (vc *)&handle_menu_command, MI_speed_12, (gchar *)"/Speed/1" },
39  { (gchar *)"/Speed/sep", NULL, NULL, 0, (gchar *)"<Separator>" },
40  { (gchar *)"/Speed/pause", NULL, (vc *)&handle_menu_command, MI_pause, (gchar *)"<CheckItem>" },
41 };
42 
43 int GtkStatsMonitor::num_menu_entries = sizeof(menu_entries) / sizeof(GtkItemFactoryEntry);
44 
45 ////////////////////////////////////////////////////////////////////
46 // Function: GtkStatsMonitor::Constructor
47 // Access: Public
48 // Description:
49 ////////////////////////////////////////////////////////////////////
50 GtkStatsMonitor::
51 GtkStatsMonitor(GtkStatsServer *server) : PStatMonitor(server) {
52  _window = NULL;
53  _item_factory = NULL;
54 
55  // These will be filled in later when the menu is created.
56  _time_units = 0;
57  _scroll_speed = 0.0;
58  _pause = false;
59 }
60 
61 ////////////////////////////////////////////////////////////////////
62 // Function: GtkStatsMonitor::Destructor
63 // Access: Public, Virtual
64 // Description:
65 ////////////////////////////////////////////////////////////////////
66 GtkStatsMonitor::
67 ~GtkStatsMonitor() {
68  shutdown();
69 }
70 
71 ////////////////////////////////////////////////////////////////////
72 // Function: GtkStatsMonitor::get_monitor_name
73 // Access: Public, Virtual
74 // Description: Should be redefined to return a descriptive name for
75 // the type of PStatsMonitor this is.
76 ////////////////////////////////////////////////////////////////////
77 string GtkStatsMonitor::
79  return "GtkStats";
80 }
81 
82 ////////////////////////////////////////////////////////////////////
83 // Function: GtkStatsMonitor::initialized
84 // Access: Public, Virtual
85 // Description: Called after the monitor has been fully set up. At
86 // this time, it will have a valid _client_data pointer,
87 // and things like is_alive() and close() will be
88 // meaningful. However, we may not yet know who we're
89 // connected to (is_client_known() may return false),
90 // and we may not know anything about the threads or
91 // collectors we're about to get data on.
92 ////////////////////////////////////////////////////////////////////
95 }
96 
97 ////////////////////////////////////////////////////////////////////
98 // Function: GtkStatsMonitor::got_hello
99 // Access: Public, Virtual
100 // Description: Called when the "hello" message has been received
101 // from the client. At this time, the client's hostname
102 // and program name will be known.
103 ////////////////////////////////////////////////////////////////////
106  create_window();
107  open_strip_chart(0, 0, false);
108 }
109 
110 ////////////////////////////////////////////////////////////////////
111 // Function: GtkStatsMonitor::got_bad_version
112 // Access: Public, Virtual
113 // Description: Like got_hello(), this is called when the "hello"
114 // message has been received from the client. At this
115 // time, the client's hostname and program name will be
116 // known. However, the client appears to be an
117 // incompatible version and the connection will be
118 // terminated; the monitor should issue a message to
119 // that effect.
120 ////////////////////////////////////////////////////////////////////
122 got_bad_version(int client_major, int client_minor,
123  int server_major, int server_minor) {
124  ostringstream str;
125  str << "Unable to honor connection attempt from "
126  << get_client_progname() << " on " << get_client_hostname()
127  << ": unsupported PStats version "
128  << client_major << "." << client_minor;
129 
130  if (server_minor == 0) {
131  str << " (server understands version " << server_major
132  << "." << server_minor << " only).";
133  } else {
134  str << " (server understands versions " << server_major
135  << ".0 through " << server_major << "." << server_minor << ").";
136  }
137 
138  string message = str.str();
139  GtkWidget *dialog =
140  gtk_message_dialog_new(GTK_WINDOW(main_window),
141  GTK_DIALOG_DESTROY_WITH_PARENT,
142  GTK_MESSAGE_ERROR,
143  GTK_BUTTONS_CLOSE,
144  "%s", message.c_str());
145  gtk_dialog_run(GTK_DIALOG(dialog));
146  gtk_widget_destroy(dialog);
147 }
148 
149 ////////////////////////////////////////////////////////////////////
150 // Function: GtkStatsMonitor::new_collector
151 // Access: Public, Virtual
152 // Description: Called whenever a new Collector definition is
153 // received from the client. Generally, the client will
154 // send all of its collectors over shortly after
155 // connecting, but there's no guarantee that they will
156 // all be received before the first frames are received.
157 // The monitor should be prepared to accept new Collector
158 // definitions midstream.
159 ////////////////////////////////////////////////////////////////////
161 new_collector(int collector_index) {
162  Graphs::iterator gi;
163  for (gi = _graphs.begin(); gi != _graphs.end(); ++gi) {
164  GtkStatsGraph *graph = (*gi);
165  graph->new_collector(collector_index);
166  }
167 
168  // We might need to update our menus.
169  ChartMenus::iterator mi;
170  for (mi = _chart_menus.begin(); mi != _chart_menus.end(); ++mi) {
171  (*mi)->do_update();
172  }
173 }
174 
175 ////////////////////////////////////////////////////////////////////
176 // Function: GtkStatsMonitor::new_thread
177 // Access: Public, Virtual
178 // Description: Called whenever a new Thread definition is
179 // received from the client. Generally, the client will
180 // send all of its threads over shortly after
181 // connecting, but there's no guarantee that they will
182 // all be received before the first frames are received.
183 // The monitor should be prepared to accept new Thread
184 // definitions midstream.
185 ////////////////////////////////////////////////////////////////////
187 new_thread(int thread_index) {
188  GtkStatsChartMenu *chart_menu = new GtkStatsChartMenu(this, thread_index);
189  GtkWidget *menu_bar = gtk_item_factory_get_widget(_item_factory, "<PStats>");
190  chart_menu->add_to_menu_bar(menu_bar, _next_chart_index);
191  ++_next_chart_index;
192  _chart_menus.push_back(chart_menu);
193 }
194 
195 ////////////////////////////////////////////////////////////////////
196 // Function: GtkStatsMonitor::new_data
197 // Access: Public, Virtual
198 // Description: Called as each frame's data is made available. There
199 // is no guarantee the frames will arrive in order, or
200 // that all of them will arrive at all. The monitor
201 // should be prepared to accept frames received
202 // out-of-order or missing.
203 ////////////////////////////////////////////////////////////////////
205 new_data(int thread_index, int frame_number) {
206  Graphs::iterator gi;
207  for (gi = _graphs.begin(); gi != _graphs.end(); ++gi) {
208  GtkStatsGraph *graph = (*gi);
209  graph->new_data(thread_index, frame_number);
210  }
211 }
212 
213 
214 ////////////////////////////////////////////////////////////////////
215 // Function: GtkStatsMonitor::lost_connection
216 // Access: Public, Virtual
217 // Description: Called whenever the connection to the client has been
218 // lost. This is a permanent state change. The monitor
219 // should update its display to represent this, and may
220 // choose to close down automatically.
221 ////////////////////////////////////////////////////////////////////
224  nout << "Lost connection to " << get_client_hostname() << "\n";
225 
226  shutdown();
227 }
228 
229 ////////////////////////////////////////////////////////////////////
230 // Function: GtkStatsMonitor::idle
231 // Access: Public, Virtual
232 // Description: If has_idle() returns true, this will be called
233 // periodically to allow the monitor to update its
234 // display or whatever it needs to do.
235 ////////////////////////////////////////////////////////////////////
237 idle() {
238  // Check if any of our chart menus need updating.
239  ChartMenus::iterator mi;
240  for (mi = _chart_menus.begin(); mi != _chart_menus.end(); ++mi) {
241  (*mi)->check_update();
242  }
243 
244  // Update the frame rate label from the main thread (thread 0).
245  const PStatThreadData *thread_data = get_client_data()->get_thread_data(0);
246  double frame_rate = thread_data->get_frame_rate();
247  if (frame_rate != 0.0f) {
248  char buffer[128];
249  sprintf(buffer, "%0.1f ms / %0.1f Hz", 1000.0f / frame_rate, frame_rate);
250 
251  gtk_label_set_text(GTK_LABEL(_frame_rate_label), buffer);
252  }
253 }
254 
255 ////////////////////////////////////////////////////////////////////
256 // Function: GtkStatsMonitor::has_idle
257 // Access: Public, Virtual
258 // Description: Should be redefined to return true if you want to
259 // redefine idle() and expect it to be called.
260 ////////////////////////////////////////////////////////////////////
263  return true;
264 }
265 
266 ////////////////////////////////////////////////////////////////////
267 // Function: GtkStatsMonitor::user_guide_bars_changed
268 // Access: Public, Virtual
269 // Description: Called when the user guide bars have been changed.
270 ////////////////////////////////////////////////////////////////////
273  Graphs::iterator gi;
274  for (gi = _graphs.begin(); gi != _graphs.end(); ++gi) {
275  GtkStatsGraph *graph = (*gi);
276  graph->user_guide_bars_changed();
277  }
278 }
279 
280 ////////////////////////////////////////////////////////////////////
281 // Function: GtkStatsMonitor::get_window
282 // Access: Public
283 // Description: Returns the window handle to the monitor's window.
284 ////////////////////////////////////////////////////////////////////
285 GtkWidget *GtkStatsMonitor::
286 get_window() const {
287  return _window;
288 }
289 
290 ////////////////////////////////////////////////////////////////////
291 // Function: GtkStatsMonitor::open_strip_chart
292 // Access: Public
293 // Description: Opens a new strip chart showing the indicated data.
294 ////////////////////////////////////////////////////////////////////
296 open_strip_chart(int thread_index, int collector_index, bool show_level) {
297  GtkStatsStripChart *graph =
298  new GtkStatsStripChart(this, thread_index, collector_index, show_level);
299  add_graph(graph);
300 
301  graph->set_time_units(_time_units);
302  graph->set_scroll_speed(_scroll_speed);
303  graph->set_pause(_pause);
304 }
305 
306 ////////////////////////////////////////////////////////////////////
307 // Function: GtkStatsMonitor::open_piano_roll
308 // Access: Public
309 // Description: Opens a new piano roll showing the indicated data.
310 ////////////////////////////////////////////////////////////////////
312 open_piano_roll(int thread_index) {
313  GtkStatsPianoRoll *graph = new GtkStatsPianoRoll(this, thread_index);
314  add_graph(graph);
315 
316  graph->set_time_units(_time_units);
317  graph->set_scroll_speed(_scroll_speed);
318  graph->set_pause(_pause);
319 }
320 
321 ////////////////////////////////////////////////////////////////////
322 // Function: GtkStatsMonitor::add_menu
323 // Access: Public
324 // Description: Adds a new MenuDef to the monitor, or returns an
325 // existing one if there is already one just like it.
326 ////////////////////////////////////////////////////////////////////
328 add_menu(const MenuDef &menu_def) {
329  pair<Menus::iterator, bool> result = _menus.insert(menu_def);
330  Menus::iterator mi = result.first;
331  const GtkStatsMonitor::MenuDef &new_menu_def = (*mi);
332  if (result.second) {
333  // A new MenuDef was inserted.
334  ((GtkStatsMonitor::MenuDef &)new_menu_def)._monitor = this;
335  }
336  return &new_menu_def;
337 }
338 
339 ////////////////////////////////////////////////////////////////////
340 // Function: GtkStatsMonitor::set_time_units
341 // Access: Public
342 // Description: Called when the user selects a new time units from
343 // the monitor pulldown menu, this should adjust the
344 // units for all graphs to the indicated mask if it is a
345 // time-based graph.
346 ////////////////////////////////////////////////////////////////////
348 set_time_units(int unit_mask) {
349  _time_units = unit_mask;
350 
351  // First, change all of the open graphs appropriately.
352  Graphs::iterator gi;
353  for (gi = _graphs.begin(); gi != _graphs.end(); ++gi) {
354  GtkStatsGraph *graph = (*gi);
355  graph->set_time_units(_time_units);
356  }
357 }
358 
359 ////////////////////////////////////////////////////////////////////
360 // Function: GtkStatsMonitor::set_scroll_speed
361 // Access: Public
362 // Description: Called when the user selects a new scroll speed from
363 // the monitor pulldown menu, this should adjust the
364 // speeds for all graphs to the indicated value.
365 ////////////////////////////////////////////////////////////////////
367 set_scroll_speed(double scroll_speed) {
368  _scroll_speed = scroll_speed;
369 
370  // First, change all of the open graphs appropriately.
371  Graphs::iterator gi;
372  for (gi = _graphs.begin(); gi != _graphs.end(); ++gi) {
373  GtkStatsGraph *graph = (*gi);
374  graph->set_scroll_speed(_scroll_speed);
375  }
376 }
377 
378 ////////////////////////////////////////////////////////////////////
379 // Function: GtkStatsMonitor::set_pause
380 // Access: Public
381 // Description: Called when the user selects a pause on or pause off
382 // option from the menu.
383 ////////////////////////////////////////////////////////////////////
385 set_pause(bool pause) {
386  _pause = pause;
387 
388  // First, change all of the open graphs appropriately.
389  Graphs::iterator gi;
390  for (gi = _graphs.begin(); gi != _graphs.end(); ++gi) {
391  GtkStatsGraph *graph = (*gi);
392  graph->set_pause(_pause);
393  }
394 }
395 
396 ////////////////////////////////////////////////////////////////////
397 // Function: GtkStatsMonitor::add_graph
398 // Access: Private
399 // Description: Adds the newly-created graph to the list of managed
400 // graphs.
401 ////////////////////////////////////////////////////////////////////
402 void GtkStatsMonitor::
403 add_graph(GtkStatsGraph *graph) {
404  _graphs.insert(graph);
405 }
406 
407 ////////////////////////////////////////////////////////////////////
408 // Function: GtkStatsMonitor::remove_graph
409 // Access: Private
410 // Description: Deletes the indicated graph.
411 ////////////////////////////////////////////////////////////////////
412 void GtkStatsMonitor::
413 remove_graph(GtkStatsGraph *graph) {
414  Graphs::iterator gi = _graphs.find(graph);
415  if (gi != _graphs.end()) {
416  _graphs.erase(gi);
417  delete graph;
418  }
419 }
420 
421 ////////////////////////////////////////////////////////////////////
422 // Function: GtkStatsMonitor::create_window
423 // Access: Private
424 // Description: Creates the window for this monitor.
425 ////////////////////////////////////////////////////////////////////
426 void GtkStatsMonitor::
427 create_window() {
428  if (_window != NULL) {
429  return;
430  }
431 
432  _window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
433 
434  g_signal_connect(G_OBJECT(_window), "delete_event",
435  G_CALLBACK(window_delete_event), this);
436  g_signal_connect(G_OBJECT(_window), "destroy",
437  G_CALLBACK(window_destroy), this);
438 
439  _window_title = get_client_progname() + " on " + get_client_hostname();
440  gtk_window_set_title(GTK_WINDOW(_window), _window_title.c_str());
441 
442  gtk_window_set_default_size(GTK_WINDOW(_window), 500, 360);
443 
444  // Set up the menu.
445  GtkAccelGroup *accel_group = gtk_accel_group_new();
446  _item_factory =
447  gtk_item_factory_new(GTK_TYPE_MENU_BAR, "<PStats>", accel_group);
448  gtk_item_factory_create_items(_item_factory, num_menu_entries, menu_entries,
449  this);
450  gtk_window_add_accel_group(GTK_WINDOW(_window), accel_group);
451  GtkWidget *menu_bar = gtk_item_factory_get_widget(_item_factory, "<PStats>");
452  _next_chart_index = 2;
453 
454  setup_frame_rate_label();
455 
456  ChartMenus::iterator mi;
457  for (mi = _chart_menus.begin(); mi != _chart_menus.end(); ++mi) {
458  (*mi)->add_to_menu_bar(menu_bar, _next_chart_index);
459  ++_next_chart_index;
460  }
461 
462  // Pack the menu into the window.
463  GtkWidget *main_vbox = gtk_vbox_new(FALSE, 1);
464  gtk_container_add(GTK_CONTAINER(_window), main_vbox);
465  gtk_box_pack_start(GTK_BOX(main_vbox), menu_bar, FALSE, TRUE, 0);
466 
467  gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item(_item_factory, "/Speed/3")),
468  TRUE);
469  set_scroll_speed(3);
470 
471  gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtk_item_factory_get_item(_item_factory, "/Options/Units/ms")),
472  TRUE);
473  set_time_units(PStatGraph::GBU_ms);
474 
475  gtk_widget_show_all(_window);
476  gtk_widget_show(_window);
477 
478  set_pause(false);
479 }
480 
481 ////////////////////////////////////////////////////////////////////
482 // Function: GtkStatsMonitor::shutdown
483 // Access: Private
484 // Description: Closes all the graphs associated with this monitor.
485 ////////////////////////////////////////////////////////////////////
486 void GtkStatsMonitor::
487 shutdown() {
488  Graphs::iterator gi;
489  for (gi = _graphs.begin(); gi != _graphs.end(); ++gi) {
490  delete (*gi);
491  }
492  _graphs.clear();
493 
494  ChartMenus::iterator mi;
495  for (mi = _chart_menus.begin(); mi != _chart_menus.end(); ++mi) {
496  delete (*mi);
497  }
498  _chart_menus.clear();
499 
500  if (_window != NULL) {
501  gtk_widget_destroy(_window);
502  _window = NULL;
503  }
504 
505 #ifdef DEVELOP_GTKSTATS
506  // For GtkStats developers, exit when the first monitor closes.
507  gtk_main_quit();
508 #endif
509 }
510 
511 ////////////////////////////////////////////////////////////////////
512 // Function: GtkStatsMonitor::window_delete_event
513 // Access: Private, Static
514 // Description: Callback when the window is closed by the user.
515 ////////////////////////////////////////////////////////////////////
516 gboolean GtkStatsMonitor::
517 window_delete_event(GtkWidget *widget, GdkEvent *event, gpointer data) {
518  // Returning FALSE to indicate we should destroy the window
519  // when the user selects "close".
520  return FALSE;
521 }
522 
523 ////////////////////////////////////////////////////////////////////
524 // Function: GtkStatsMonitor::window_destroy
525 // Access: Private, Static
526 // Description: Callback when the window is destroyed by the system
527 // (or by delete_event).
528 ////////////////////////////////////////////////////////////////////
529 void GtkStatsMonitor::
530 window_destroy(GtkWidget *widget, gpointer data) {
531  GtkStatsMonitor *self = (GtkStatsMonitor *)data;
532  self->close();
533 }
534 
535 ////////////////////////////////////////////////////////////////////
536 // Function: GtkStatsMonitor::setup_frame_rate_label
537 // Access: Private
538 // Description: Creates the frame rate label on the right end of the
539 // menu bar. This is used as a text label to display
540 // the main thread's frame rate to the user, although it
541 // is implemented as a right-justified toplevel menu
542 // item that doesn't open to anything.
543 ////////////////////////////////////////////////////////////////////
544 void GtkStatsMonitor::
545 setup_frame_rate_label() {
546  GtkWidget *menu_bar = gtk_item_factory_get_widget(_item_factory, "<PStats>");
547 
548  _frame_rate_menu_item = gtk_menu_item_new();
549  _frame_rate_label = gtk_label_new("");
550  gtk_container_add(GTK_CONTAINER(_frame_rate_menu_item), _frame_rate_label);
551 
552  gtk_widget_show(_frame_rate_menu_item);
553  gtk_widget_show(_frame_rate_label);
554  gtk_menu_item_right_justify(GTK_MENU_ITEM(_frame_rate_menu_item));
555 
556  gtk_menu_shell_append(GTK_MENU_SHELL(menu_bar), _frame_rate_menu_item);
557 }
558 
559 ////////////////////////////////////////////////////////////////////
560 // Function: GtkStatsMonitor::handle_menu_command
561 // Access: Private, Static
562 // Description:
563 ////////////////////////////////////////////////////////////////////
564 void GtkStatsMonitor::
565 handle_menu_command(gpointer callback_data, guint menu_id, GtkWidget *widget) {
566  GtkStatsMonitor *self = (GtkStatsMonitor *)callback_data;
567  switch (menu_id) {
568  case MI_none:
569  break;
570 
571  case MI_time_ms:
572  self->set_time_units(PStatGraph::GBU_ms);
573  break;
574 
575  case MI_time_hz:
576  self->set_time_units(PStatGraph::GBU_hz);
577  break;
578 
579  case MI_speed_1:
580  self->set_scroll_speed(1);
581  break;
582 
583  case MI_speed_2:
584  self->set_scroll_speed(2);
585  break;
586 
587  case MI_speed_3:
588  self->set_scroll_speed(3);
589  break;
590 
591  case MI_speed_6:
592  self->set_scroll_speed(6);
593  break;
594 
595  case MI_speed_12:
596  self->set_scroll_speed(12);
597  break;
598 
599  case MI_pause:
600  self->set_pause(gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)));
601  break;
602  }
603 }
string get_client_progname() const
Returns the program name of the client we&#39;re connected to, if known.
Definition: pStatMonitor.I:86
A window that draws a strip chart, given a view.
virtual void new_thread(int thread_index)
Called whenever a new Thread definition is received from the client.
virtual void set_time_units(int unit_mask)
Called when the user selects a new time units from the monitor pulldown menu, this should adjust the ...
virtual void got_hello()
Called when the &quot;hello&quot; message has been received from the client.
void open_piano_roll(int thread_index)
Opens a new piano roll showing the indicated data.
virtual void new_data(int thread_index, int frame_number)
Called whenever new data arrives.
void user_guide_bars_changed()
Called when the user guide bars have been changed.
void set_pause(bool pause)
Changes the pause flag for the graph.
The class that owns the main loop, waiting for client connections.
virtual string get_monitor_name()
Should be redefined to return a descriptive name for the type of PStatsMonitor this is...
GtkWidget * get_window() const
Returns the window handle to the monitor&#39;s window.
void close()
Closes the client connection if it is active.
virtual void got_bad_version(int client_major, int client_minor, int server_major, int server_minor)
Like got_hello(), this is called when the &quot;hello&quot; message has been received from the client...
virtual void new_collector(int collector_index)
Called whenever a new Collector definition is received from the client.
A window that draws a piano-roll style chart, which shows the collectors explicitly stopping and star...
virtual void user_guide_bars_changed()
Called when the user guide bars have been changed.
This is an abstract class that presents the interface to any number of different front-ends for the s...
Definition: pStatMonitor.h:43
string get_client_hostname() const
Returns the hostname of the client we&#39;re connected to, if known.
Definition: pStatMonitor.I:72
A pulldown menu of charts available for a particular thread.
virtual void set_time_units(int unit_mask)
Called when the user selects a new time units from the monitor pulldown menu, this should adjust the ...
void add_to_menu_bar(GtkWidget *menu_bar, int position)
Adds the menu to the end of the indicated menu bar.
virtual void set_scroll_speed(double scroll_speed)
Called when the user selects a new scroll speed from the monitor pulldown menu, this should adjust th...
This is just an abstract base class to provide a common pointer type for the various kinds of graphs ...
Definition: gtkStatsGraph.h:32
A collection of FrameData structures for recently-received frames within a particular thread...
const MenuDef * add_menu(const MenuDef &menu_def)
Adds a new MenuDef to the monitor, or returns an existing one if there is already one just like it...
This class represents a connection to a PStatsClient and manages the data exchange with the client...
void open_strip_chart(int thread_index, int collector_index, bool show_level)
Opens a new strip chart showing the indicated data.
const PStatClientData * get_client_data() const
Returns the client data associated with this monitor.
Definition: pStatMonitor.I:32
void set_time_units(int unit_mask)
Called when the user selects a new time units from the monitor pulldown menu, this should adjust the ...
const PStatThreadData * get_thread_data(int index) const
Returns the data associated with the indicated thread.
virtual void set_time_units(int unit_mask)
Called when the user selects a new time units from the monitor pulldown menu, this should adjust the ...
virtual void initialized()
Called after the monitor has been fully set up.
virtual void new_data(int thread_index, int frame_number)
Called as each frame&#39;s data is made available.
virtual void set_scroll_speed(double scroll_speed)
Called when the user selects a new scroll speed from the monitor pulldown menu, this should adjust th...
virtual void lost_connection()
Called whenever the connection to the client has been lost.
virtual bool has_idle()
Should be redefined to return true if you want to redefine idle() and expect it to be called...
virtual void idle()
If has_idle() returns true, this will be called periodically to allow the monitor to update its displ...
void set_scroll_speed(double scroll_speed)
Called when the user selects a new scroll speed from the monitor pulldown menu, this should adjust th...
virtual void new_collector(int collector_index)
Called whenever a new Collector definition is received from the client.
void set_pause(bool pause)
Called when the user selects a pause on or pause off option from the menu.
double get_frame_rate() const
Computes the average frame rate over the past pstats_average_time seconds, by counting up the number ...