pqMemoryInspectorPanel.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-License-Identifier: BSD-3-Clause
3 #ifndef pqMemoryInspectorPanel_h
4 #define pqMemoryInspectorPanel_h
5 
6 #include "pqComponentsModule.h"
7 #include <QMenu>
8 #include <QProcess>
9 #include <QWidget>
10 
11 #include <map>
12 using std::map;
13 #include <string>
14 using std::string;
15 #include <vector>
16 using std::vector;
17 
18 class pqMemoryInspectorPanelUI;
19 class HostData;
20 class RankData;
21 class QTreeWidgetItem;
23 class pqView;
24 
26 {
27  Q_OBJECT
28 public:
29  pqMemoryInspectorPanel(QWidget* parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags{});
30  ~pqMemoryInspectorPanel() override;
31 
32  // Description:
33  // Test for successful initialization.
34  int Initialized() { return this->ClientHost != nullptr; }
35 
36 protected:
37  // Description:
38  // Update when the panel is made visible.
39  void showEvent(QShowEvent* event) override;
40 
41 protected Q_SLOTS: // NOLINT(readability-redundant-access-specifiers)
42 
43  // Description:
44  // Configure the UI based on conneccted servers.
45  void ServerDisconnected();
46  void ServerConnected();
47 
48  // Description:
49  // The panel will update itself after render events end. Render events are
50  // used because they occur only after all server side action is complete
51  // and rendering initself can use significant resources. The update is
52  // enabled only after pqView::dataUpdatedEvent.
53  void ConnectToView(pqView* view);
54  void RenderCompleted();
55  void EnableUpdate();
56 
57  // Description:
58  // Clear all member variables and models.
59  void Clear();
60 
61  // Description:
62  // Update the UI with values from the server(s).
63  int Initialize();
64 
65  // Description:
66  // Update the UI with the latest values from the server(s).
67  void Update();
68 
69  // Description:
70  // Enable auto update.
71  void SetAutoUpdate(bool state) { this->AutoUpdate = state; }
72 
73  // Description:
74  // enable/disable stack trace.
75  void EnableStackTraceOnClient(bool enable);
76  void EnableStackTraceOnServer(bool enable);
77  void EnableStackTraceOnDataServer(bool enable);
78  void EnableStackTraceOnRenderServer(bool enable);
79 
80  // Description:
81  // run remote command on one of the client or server ranks.
82  void ExecuteRemoteCommand();
83  void RemoteCommandFailed(QProcess::ProcessError code);
84 
85  // Description:
86  // Display host properties
87  void ShowHostPropertiesDialog();
88 
89  // Description:
90  // Create a context menu for the config view.
91  void ConfigViewContextMenu(const QPoint& pos);
92 
93  // Description:
94  // Collapse or expand the view for easier navigation
95  // when larger jobs are in play.
96  void ShowOnlyNodes();
97  void ShowAllRanks();
98 
99 private:
100  void ClearClient();
101  void ClearServers();
102  void ClearServer(map<string, HostData*>& hosts, vector<RankData*>& ranks);
103 
104  void UpdateRanks();
105  void UpdateHosts();
106  void UpdateHosts(map<string, HostData*>& hosts);
107 
108  void InitializeServerGroup(long long clientPid, vtkPVSystemConfigInformation* configs,
109  int validProcessType, QTreeWidgetItem* group, string groupName, map<string, HostData*>& hosts,
110  vector<RankData*>& ranks, int& systemType);
111 
112  void EnableStackTrace(bool enable, int group);
113  void AddEnableStackTraceMenuAction(int serverType, QMenu& context);
114 
115  QWidget* NewGroupWidget(string name, string icon);
116 
117  pqMemoryInspectorPanelUI* Ui;
118 
119  bool ClientOnly;
120  HostData* ClientHost;
121  int ClientSystemType;
122  bool StackTraceOnClient;
123 
124  map<string, HostData*> ServerHosts;
125  vector<RankData*> ServerRanks;
126  int ServerSystemType;
127  bool StackTraceOnServer;
128 
129  map<string, HostData*> DataServerHosts;
130  vector<RankData*> DataServerRanks;
131  int DataServerSystemType;
132  bool StackTraceOnDataServer;
133 
134  map<string, HostData*> RenderServerHosts;
135  vector<RankData*> RenderServerRanks;
136  int RenderServerSystemType;
137  bool StackTraceOnRenderServer;
138 
139  bool UpdateEnabled;
140  bool PendingUpdate;
141  bool AutoUpdate;
142 };
143 
144 #endif
#define PQCOMPONENTS_EXPORT
A vtkClientServerStream serializable container of information describing memory configuration of the ...
virtual void Update()
This is a PQ abstraction of a generic view module.
Definition: pqView.h:26
name