ParaView
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;
34 class vtkPVSystemConfigInformation;
35 class pqView;
36 
37 class PQCOMPONENTS_EXPORT pqMemoryInspectorPanel : public QWidget
38 {
39  Q_OBJECT
40 public:
41  pqMemoryInspectorPanel(QWidget* parent=0, Qt::WindowFlags f=0);
43 
44  // Description:
45  // Test for successful initialization.
46  int Initialized(){ return this->ClientHost!=NULL; }
47 
48 protected:
49  // Description:
50  // Update when the panel is made visible.
51  virtual void showEvent(QShowEvent *event);
52 
53 protected slots:
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  // Update the UI with values from the server(s).
71  int Initialize();
72 
73  // Description:
74  // Update the UI with the latest values from the server(s).
75  void Update();
76 
77  // Description:
78  // Enable auto update.
79  void SetAutoUpdate(bool state){ this->AutoUpdate=state; }
80 
81  // Description:
82  // enable/disable stack trace.
83  void EnableStackTraceOnClient(bool enable);
84  void EnableStackTraceOnServer(bool enable);
85  void EnableStackTraceOnDataServer(bool enable);
86  void EnableStackTraceOnRenderServer(bool enable);
87 
88  // Description:
89  // run remote command on one of the client or server ranks.
90  void ExecuteRemoteCommand();
91  void RemoteCommandFailed(QProcess::ProcessError code);
92 
93  // Description:
94  // Display host properties
95  void ShowHostPropertiesDialog();
96 
97  // Description:
98  // Create a context menu for the config view.
99  void ConfigViewContextMenu(const QPoint &pos);
100 
101  // Description:
102  // Collapse or expand the view for easier navigation
103  // when larger jobs are in play.
104  void ShowOnlyNodes();
105  void ShowAllRanks();
106 
107 private:
108  void ClearClient();
109  void ClearServers();
110  void ClearServer(
111  map<string,HostData *> &hosts,
112  vector<RankData *> &ranks);
113 
114  void UpdateRanks();
115  void UpdateHosts();
116  void UpdateHosts(map<string,HostData*> &hosts);
117 
118  void InitializeServerGroup(
119  long long clientPid,
120  vtkPVSystemConfigInformation *configs,
121  int validProcessType,
122  QTreeWidgetItem *group,
123  string groupName,
124  map<string,HostData*> &hosts,
125  vector<RankData*> &ranks,
126  int &systemType);
127 
128  void EnableStackTrace(bool enable,int group);
129  void AddEnableStackTraceMenuAction(int serverType, QMenu &context);
130 
131  QWidget *NewGroupWidget(string name, string icon);
132 
133 private:
134  pqMemoryInspectorPanelUI *Ui;
135 
136  int ClientOnly;
137  HostData *ClientHost;
138  int ClientSystemType;
139  bool StackTraceOnClient;
140 
141  map<string,HostData *> ServerHosts;
142  vector<RankData *> ServerRanks;
143  int ServerSystemType;
144  bool StackTraceOnServer;
145 
146  map<string,HostData *> DataServerHosts;
147  vector<RankData *> DataServerRanks;
148  int DataServerSystemType;
149  bool StackTraceOnDataServer;
150 
151  map<string,HostData *> RenderServerHosts;
152  vector<RankData *> RenderServerRanks;
153  int RenderServerSystemType;
154  bool StackTraceOnRenderServer;
155 
156  int UpdateEnabled;
157  int PendingUpdate;
158  bool AutoUpdate;
159 };
160 
161 #endif
This is a PQ abstraction of a generic view module.
Definition: pqView.h:55