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