mirror of
https://github.com/panda3d/panda3d.git
synced 2025-09-28 07:48:37 -04:00
pstats: Fix status bar when collector has level data on multiple threads
Status bar now shows total across all threads, and double-clicking it opens strip charts for all the threads that have data for it
This commit is contained in:
parent
759115fbc7
commit
284ffe9e83
@ -637,6 +637,7 @@ update_status_bar() {
|
|||||||
if (thread_data == nullptr || thread_data->is_empty()) {
|
if (thread_data == nullptr || thread_data->is_empty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
int frame_number = thread_data->get_latest_frame_number();
|
||||||
const PStatFrameData &frame_data = thread_data->get_latest_frame();
|
const PStatFrameData &frame_data = thread_data->get_latest_frame();
|
||||||
|
|
||||||
pvector<int> collectors;
|
pvector<int> collectors;
|
||||||
@ -666,6 +667,13 @@ update_status_bar() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add the value for other threads that have this collector.
|
||||||
|
for (int thread_index = 1; thread_index < client_data->get_num_threads(); ++thread_index) {
|
||||||
|
PStatView &view = get_level_view(collector, thread_index);
|
||||||
|
view.set_to_frame(frame_number);
|
||||||
|
value += view.get_net_value();
|
||||||
|
}
|
||||||
|
|
||||||
const PStatCollectorDef &def = client_data->get_collector_def(collector);
|
const PStatCollectorDef &def = client_data->get_collector_def(collector);
|
||||||
std::string text = def._name;
|
std::string text = def._name;
|
||||||
text += ": " + PStatGraph::format_number(value, PStatGraph::GBU_named | PStatGraph::GBU_show_units, def._level_units);
|
text += ": " + PStatGraph::format_number(value, PStatGraph::GBU_named | PStatGraph::GBU_show_units, def._level_units);
|
||||||
@ -720,6 +728,17 @@ status_bar_button_event(GtkWidget *widget, GdkEventButton *event, gpointer data)
|
|||||||
|
|
||||||
if (event->type == GDK_2BUTTON_PRESS && event->button == 1) {
|
if (event->type == GDK_2BUTTON_PRESS && event->button == 1) {
|
||||||
monitor->open_strip_chart(0, collector, collector != 0);
|
monitor->open_strip_chart(0, collector, collector != 0);
|
||||||
|
|
||||||
|
// Also open a strip chart for other threads with data for this
|
||||||
|
// collector.
|
||||||
|
if (collector != 0) {
|
||||||
|
for (int thread_index = 1; thread_index < client_data->get_num_threads(); ++thread_index) {
|
||||||
|
PStatView &view = monitor->get_level_view(collector, thread_index);
|
||||||
|
if (view.get_net_value() > 0.0) {
|
||||||
|
monitor->open_strip_chart(thread_index, collector, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
else if (event->type == GDK_BUTTON_PRESS && event->button == 3 && index > 0) {
|
else if (event->type == GDK_BUTTON_PRESS && event->button == 3 && index > 0) {
|
||||||
|
@ -712,6 +712,7 @@ update_status_bar() {
|
|||||||
if (thread_data == nullptr || thread_data->is_empty()) {
|
if (thread_data == nullptr || thread_data->is_empty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
int frame_number = thread_data->get_latest_frame_number();
|
||||||
const PStatFrameData &frame_data = thread_data->get_latest_frame();
|
const PStatFrameData &frame_data = thread_data->get_latest_frame();
|
||||||
|
|
||||||
// Gather the top-level collector list.
|
// Gather the top-level collector list.
|
||||||
@ -734,6 +735,13 @@ update_status_bar() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add the value for other threads that have this collector.
|
||||||
|
for (int thread_index = 1; thread_index < client_data->get_num_threads(); ++thread_index) {
|
||||||
|
PStatView &view = get_level_view(collector, thread_index);
|
||||||
|
view.set_to_frame(frame_number);
|
||||||
|
value += view.get_net_value();
|
||||||
|
}
|
||||||
|
|
||||||
const PStatCollectorDef &def = client_data->get_collector_def(collector);
|
const PStatCollectorDef &def = client_data->get_collector_def(collector);
|
||||||
std::string text = "\t" + def._name;
|
std::string text = "\t" + def._name;
|
||||||
text += ": " + PStatGraph::format_number(value, PStatGraph::GBU_named | PStatGraph::GBU_show_units, def._level_units);
|
text += ": " + PStatGraph::format_number(value, PStatGraph::GBU_named | PStatGraph::GBU_show_units, def._level_units);
|
||||||
@ -944,6 +952,16 @@ window_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) {
|
|||||||
else if (mouse.dwItemSpec >= 1 && mouse.dwItemSpec <= _status_bar_collectors.size()) {
|
else if (mouse.dwItemSpec >= 1 && mouse.dwItemSpec <= _status_bar_collectors.size()) {
|
||||||
int collector = _status_bar_collectors[mouse.dwItemSpec - 1];
|
int collector = _status_bar_collectors[mouse.dwItemSpec - 1];
|
||||||
open_strip_chart(0, collector, true);
|
open_strip_chart(0, collector, true);
|
||||||
|
|
||||||
|
// Also open a strip chart for other threads with data for this
|
||||||
|
// collector.
|
||||||
|
const PStatClientData *client_data = get_client_data();
|
||||||
|
for (int thread_index = 1; thread_index < client_data->get_num_threads(); ++thread_index) {
|
||||||
|
PStatView &view = get_level_view(collector, thread_index);
|
||||||
|
if (view.get_net_value() > 0.0) {
|
||||||
|
open_strip_chart(thread_index, collector, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user