15 #include "winStatsChartMenu.h"
16 #include "winStatsMonitor.h"
26 _thread_index(thread_index)
28 _menu = CreatePopupMenu();
38 ~WinStatsChartMenu() {
61 if (_thread_index == 0) {
63 thread_name =
"Graphs";
69 memset(&mii, 0,
sizeof(mii));
70 mii.cbSize =
sizeof(mii);
72 mii.fMask = MIIM_STRING | MIIM_FTYPE | MIIM_SUBMENU;
73 mii.fType = MFT_STRING;
75 mii.dwTypeData = (
char *)thread_name.c_str();
76 InsertMenuItem(menu_bar, before_menu_id, FALSE, &mii);
106 int num_items = GetMenuItemCount(_menu);
107 for (
int i = num_items - 1; i >= 0; i--) {
108 DeleteMenu(_menu, i, MF_BYPOSITION);
116 bool needs_separator =
true;
118 memset(&mii, 0,
sizeof(mii));
119 mii.cbSize =
sizeof(mii);
124 for (
int tc = 0; tc < num_toplevel_collectors; tc++) {
131 if (needs_separator) {
132 mii.fMask = MIIM_FTYPE;
133 mii.fType = MFT_SEPARATOR;
134 InsertMenuItem(_menu, GetMenuItemCount(_menu), TRUE, &mii);
136 needs_separator =
false;
145 mii.fMask = MIIM_FTYPE;
146 mii.fType = MFT_SEPARATOR;
147 InsertMenuItem(_menu, GetMenuItemCount(_menu), TRUE, &mii);
152 mii.fMask = MIIM_STRING | MIIM_FTYPE | MIIM_ID;
153 mii.fType = MFT_STRING;
155 mii.dwTypeData =
"Piano Roll";
156 InsertMenuItem(_menu, GetMenuItemCount(_menu), TRUE, &mii);
165 void WinStatsChartMenu::
166 add_view(HMENU parent_menu,
const PStatViewLevel *view_level,
bool show_level) {
176 memset(&mii, 0,
sizeof(mii));
177 mii.cbSize =
sizeof(mii);
179 mii.fMask = MIIM_STRING | MIIM_FTYPE | MIIM_ID;
180 mii.fType = MFT_STRING;
182 mii.dwTypeData = (
char *)collector_name.c_str();
183 InsertMenuItem(parent_menu, GetMenuItemCount(parent_menu), TRUE, &mii);
186 if (num_children > 1) {
189 HMENU submenu = CreatePopupMenu();
190 string submenu_name = collector_name +
" components";
192 mii.fMask = MIIM_STRING | MIIM_FTYPE | MIIM_SUBMENU;
193 mii.fType = MFT_STRING;
194 mii.hSubMenu = submenu;
195 mii.dwTypeData = (
char *)submenu_name.c_str();
196 InsertMenuItem(parent_menu, GetMenuItemCount(parent_menu), TRUE, &mii);
201 for (
int c = num_children - 1; c >= 0; c--) {
202 add_view(submenu, view_level->
get_child(c), show_level);
string get_thread_name(int index) const
Returns the name of the indicated thread.
int get_level_index() const
Returns an index number that can be used to determine when the set of known levels has changed...
const PStatViewLevel * get_top_level()
Returns a pointer to the level that corresponds to the Collector we've constrained to...
const PStatViewLevel * get_child(int n) const
Returns the nth child of this Level/Collector.
string get_collector_name(int index) const
Returns the name of the indicated collector.
PStatView & get_level_view(int collector_index, int thread_index)
Returns a view on the level value (as opposed to elapsed time) for the given collector over the given...
The data associated with a particular client, but not with any one particular frame or thread: the li...
bool has_collector(int index) const
Returns true if the indicated collector has been defined by the client already, false otherwise...
This is a single level value, or band of color, within a View.
A View boils down the frame data to a linear list of times spent in a number of different Collectors...
PStatView & get_view(int thread_index)
Returns a view on the given thread index.
int get_toplevel_collector(int index) const
Returns the collector index of the nth toplevel collector.
This class represents a connection to a PStatsClient and manages the data exchange with the client...
const PStatClientData * get_client_data() const
Returns the client data associated with this monitor.
bool get_collector_has_level(int index, int thread_index) const
Returns whether the given collector has level data (and consequently, whether it should appear on the...
int get_num_children() const
Returns the number of children of this Level/Collector.
int get_menu_id(const MenuDef &menu_def)
Returns the menu ID that is reserved for the indicated MenuDef properties.
int get_num_toplevel_collectors() const
Returns the total number of collectors that are toplevel collectors.
int get_collector() const
Returns the Collector index associated with this level.