globals.cpp 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /************************************************************************
  2. * file name : globals.cpp
  3. * ----------------- :
  4. * creation time : 2016/08/03
  5. * author : Victor Zarubkin
  6. * email : [email protected]
  7. * ----------------- :
  8. * description : The file contains implementation of global constants and variables for profiler gui.
  9. * ----------------- :
  10. * change log : * 2016/08/03 Victor Zarubkin: initial commit.
  11. * :
  12. * : *
  13. * ----------------- :
  14. * license : Lightweight profiler library for c++
  15. * : Copyright(C) 2016-2017 Sergey Yagovtsev, Victor Zarubkin
  16. * :
  17. * : Licensed under either of
  18. * : * MIT license (LICENSE.MIT or http://opensource.org/licenses/MIT)
  19. * : * Apache License, Version 2.0, (LICENSE.APACHE or http://www.apache.org/licenses/LICENSE-2.0)
  20. * : at your option.
  21. * :
  22. * : The MIT License
  23. * :
  24. * : Permission is hereby granted, free of charge, to any person obtaining a copy
  25. * : of this software and associated documentation files (the "Software"), to deal
  26. * : in the Software without restriction, including without limitation the rights
  27. * : to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  28. * : of the Software, and to permit persons to whom the Software is furnished
  29. * : to do so, subject to the following conditions:
  30. * :
  31. * : The above copyright notice and this permission notice shall be included in all
  32. * : copies or substantial portions of the Software.
  33. * :
  34. * : THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
  35. * : INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
  36. * : PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  37. * : LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
  38. * : TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
  39. * : USE OR OTHER DEALINGS IN THE SOFTWARE.
  40. * :
  41. * : The Apache License, Version 2.0 (the "License")
  42. * :
  43. * : You may not use this file except in compliance with the License.
  44. * : You may obtain a copy of the License at
  45. * :
  46. * : http://www.apache.org/licenses/LICENSE-2.0
  47. * :
  48. * : Unless required by applicable law or agreed to in writing, software
  49. * : distributed under the License is distributed on an "AS IS" BASIS,
  50. * : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  51. * : See the License for the specific language governing permissions and
  52. * : limitations under the License.
  53. ************************************************************************/
  54. #define IGNORE_GLOBALS_DECLARATION
  55. #include "globals.h"
  56. #undef IGNORE_GLOBALS_DECLARATION
  57. //////////////////////////////////////////////////////////////////////////
  58. //////////////////////////////////////////////////////////////////////////
  59. namespace profiler_gui {
  60. EasyGlobals& EasyGlobals::instance()
  61. {
  62. // It's okay even without C++11 "magic statics" feature because first call happens
  63. // on application initialization - there is only one thread and no data races occur.
  64. static EasyGlobals globals;
  65. return globals;
  66. }
  67. EasyGlobals::EasyGlobals()
  68. : begin_time(0)
  69. , selected_thread(0U)
  70. , selected_block(::profiler_gui::numeric_max<decltype(selected_block)>())
  71. , selected_block_id(::profiler_gui::numeric_max<decltype(selected_block_id)>())
  72. , version(0)
  73. , frame_time(16700)
  74. , blocks_spacing(0)
  75. , blocks_size_min(2)
  76. , blocks_narrow_size(20)
  77. , max_fps_history(90)
  78. , fps_timer_interval(500)
  79. , fps_widget_line_width(2)
  80. , chrono_text_position(ChronoTextPosition_Top)
  81. , time_units(TimeUnits_ms)
  82. , connected(false)
  83. , fps_enabled(true)
  84. , use_decorated_thread_name(false)
  85. , hex_thread_id(false)
  86. , enable_event_markers(true)
  87. , enable_statistics(true)
  88. , enable_zero_length(true)
  89. , add_zero_blocks_to_hierarchy(false)
  90. , draw_graphics_items_borders(true)
  91. , hide_narrow_children(false)
  92. , hide_minsize_blocks(false)
  93. , display_only_relevant_stats(true)
  94. , collapse_items_on_tree_close(false)
  95. , all_items_expanded_by_default(true)
  96. , only_current_thread_hierarchy(false)
  97. , highlight_blocks_with_same_id(true)
  98. , selecting_block_changes_thread(true)
  99. , auto_adjust_histogram_height(true)
  100. , display_only_frames_on_histogram(false)
  101. , bind_scene_and_tree_expand_status(true)
  102. {
  103. }
  104. } // END of namespace profiler_gui.
  105. //////////////////////////////////////////////////////////////////////////
  106. //////////////////////////////////////////////////////////////////////////