diff options
Diffstat (limited to 'editor/editor_profiler.cpp')
-rw-r--r-- | editor/editor_profiler.cpp | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/editor/editor_profiler.cpp b/editor/editor_profiler.cpp index 4807f8839c..3fdeaff19d 100644 --- a/editor/editor_profiler.cpp +++ b/editor/editor_profiler.cpp @@ -102,26 +102,28 @@ void EditorProfiler::clear() { } static String _get_percent_txt(float p_value, float p_total) { - if (p_total == 0) + if (p_total == 0) { p_total = 0.00001; + } + return String::num((p_value / p_total) * 100, 1) + "%"; } String EditorProfiler::_get_time_as_text(const Metric &m, float p_time, int p_calls) { - int dmode = display_mode->get_selected(); + const int dmode = display_mode->get_selected(); if (dmode == DISPLAY_FRAME_TIME) { - return rtos(p_time); + return rtos(p_time * 1000).pad_decimals(2) + " ms"; } else if (dmode == DISPLAY_AVERAGE_TIME) { - if (p_calls == 0) - return "0"; - else - return rtos(p_time / p_calls); + if (p_calls == 0) { + return "0.00 ms"; + } else { + return rtos((p_time / p_calls) * 1000).pad_decimals(2) + " ms"; + } } else if (dmode == DISPLAY_FRAME_PERCENT) { return _get_percent_txt(p_time, m.frame_time); } else if (dmode == DISPLAY_PHYSICS_FRAME_PERCENT) { - return _get_percent_txt(p_time, m.physics_frame_time); } @@ -729,7 +731,7 @@ EditorProfiler::EditorProfiler() { h_split->set_v_size_flags(SIZE_EXPAND_FILL); variables = memnew(Tree); - variables->set_custom_minimum_size(Size2(300, 0) * EDSCALE); + variables->set_custom_minimum_size(Size2(320, 0) * EDSCALE); variables->set_hide_folding(true); h_split->add_child(variables); variables->set_hide_root(true); @@ -737,10 +739,10 @@ EditorProfiler::EditorProfiler() { variables->set_column_titles_visible(true); variables->set_column_title(0, TTR("Name")); variables->set_column_expand(0, true); - variables->set_column_min_width(0, 60); + variables->set_column_min_width(0, 60 * EDSCALE); variables->set_column_title(1, TTR("Time")); variables->set_column_expand(1, false); - variables->set_column_min_width(1, 60 * EDSCALE); + variables->set_column_min_width(1, 100 * EDSCALE); variables->set_column_title(2, TTR("Calls")); variables->set_column_expand(2, false); variables->set_column_min_width(2, 60 * EDSCALE); @@ -749,7 +751,6 @@ EditorProfiler::EditorProfiler() { graph = memnew(TextureRect); graph->set_expand(true); graph->set_mouse_filter(MOUSE_FILTER_STOP); - //graph->set_ignore_mouse(false); graph->connect("draw", this, "_graph_tex_draw"); graph->connect("gui_input", this, "_graph_tex_input"); graph->connect("mouse_exited", this, "_graph_tex_mouse_exit"); @@ -760,13 +761,10 @@ EditorProfiler::EditorProfiler() { int metric_size = CLAMP(int(EDITOR_DEF("debugger/profiler_frame_history_size", 600)), 60, 1024); frame_metrics.resize(metric_size); last_metric = -1; - //cursor_metric=-1; hover_metric = -1; EDITOR_DEF("debugger/profiler_frame_max_functions", 64); - //display_mode=DISPLAY_FRAME_TIME; - frame_delay = memnew(Timer); frame_delay->set_wait_time(0.1); frame_delay->set_one_shot(true); @@ -784,6 +782,4 @@ EditorProfiler::EditorProfiler() { seeking = false; graph_height = 1; - - //activate->set_disabled(true); } |