Skip to content
This repository was archived by the owner on Jan 31, 2025. It is now read-only.

Commit 86ecfff

Browse files
Introspection from entry (#4646)
Add --introspect option which starts introspection from the capture window creation.
1 parent 94998d3 commit 86ecfff

File tree

4 files changed

+20
-3
lines changed

4 files changed

+20
-3
lines changed

src/ClientFlags/ClientFlags.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,4 +79,7 @@ ABSL_FLAG(std::string, ssh_target_process, "",
7979
"Process name or path for SSH connection. If specified, Orbit will directly set up a ssh "
8080
"a SSH connection. This means --ssh_hostname, --ssh_user, --ssh_known_host_path and "
8181
"--ssh_key_path also need to be specified (--ssh_port will default to 22). If multiple "
82-
"instances of the same process exist, the one with the highest PID will be chosen.");
82+
"instances of the same process exist, the one with the highest PID will be chosen.");
83+
84+
// Introspection from entry point.
85+
ABSL_FLAG(bool, introspect, false, "Introspect from entry point");

src/ClientFlags/include/ClientFlags/ClientFlags.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,7 @@ ABSL_DECLARE_FLAG(std::string, ssh_known_host_path);
7373
ABSL_DECLARE_FLAG(std::string, ssh_key_path);
7474
ABSL_DECLARE_FLAG(std::string, ssh_target_process);
7575

76+
// Introspection on entry.
77+
ABSL_DECLARE_FLAG(bool, introspect);
78+
7679
#endif // CLIENT_FLAGS_CLIENT_FLAGS_H_

src/OrbitGl/IntrospectionWindow.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,8 @@ IntrospectionWindow::IntrospectionWindow(
261261
capture_data_ = std::make_unique<CaptureData>(capture_started, std::nullopt,
262262
std::move(frame_track_function_ids),
263263
CaptureData::DataSource::kLiveCapture);
264+
// Start recording on window creation.
265+
ToggleRecording();
264266
}
265267

266268
IntrospectionWindow::~IntrospectionWindow() { StopIntrospection(); }
@@ -276,6 +278,7 @@ const char* IntrospectionWindow::GetHelpText() const {
276278
bool IntrospectionWindow::IsIntrospecting() const { return introspection_listener_ != nullptr; }
277279

278280
void IntrospectionWindow::StartIntrospection() {
281+
ORBIT_LOG("Starting introspection");
279282
ORBIT_CHECK(!IsIntrospecting());
280283
set_draw_help(false);
281284
CreateTimeGraph(capture_data_.get());
@@ -286,7 +289,10 @@ void IntrospectionWindow::StartIntrospection() {
286289
api_event_variant);
287290
});
288291
}
289-
void IntrospectionWindow::StopIntrospection() { introspection_listener_ = nullptr; }
292+
void IntrospectionWindow::StopIntrospection() {
293+
ORBIT_LOG("Stopping introspection");
294+
introspection_listener_ = nullptr;
295+
}
290296

291297
void IntrospectionWindow::Draw(QPainter* painter) {
292298
ORBIT_SCOPE_FUNCTION;

src/OrbitQt/orbitmainwindow.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,11 @@ OrbitMainWindow::OrbitMainWindow(TargetConfiguration target_configuration,
186186
target_configuration_(std::move(target_configuration)) {
187187
SetupMainWindow();
188188

189+
// Start introspection from entry.
190+
if (absl::GetFlag(FLAGS_introspect)) {
191+
on_actionIntrospection_triggered();
192+
}
193+
189194
SetupStatusBarLogButton();
190195
SetupHintFrame();
191196

@@ -386,7 +391,7 @@ void OrbitMainWindow::SetupMainWindow() {
386391
std::filesystem::path icon_file_name = (orbit_base::GetExecutableDir() / "orbit.ico");
387392
this->setWindowIcon(QIcon(QString::fromStdString(icon_file_name.string())));
388393

389-
if (!absl::GetFlag(FLAGS_devmode)) {
394+
if (!absl::GetFlag(FLAGS_devmode) && !absl::GetFlag(FLAGS_introspect)) {
390395
ui->actionIntrospection->setVisible(false);
391396
}
392397
}

0 commit comments

Comments
 (0)