This repository was archived by the owner on Jan 31, 2025. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathTracingHandler.cpp
More file actions
79 lines (63 loc) · 2.94 KB
/
Copy pathTracingHandler.cpp
File metadata and controls
79 lines (63 loc) · 2.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
// Copyright (c) 2021 The Orbit Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "TracingHandler.h"
#include <absl/synchronization/mutex.h>
#include "GrpcProtos/Constants.h"
#include "OrbitBase/Logging.h"
namespace orbit_windows_capture_service {
using orbit_grpc_protos::CaptureOptions;
using orbit_grpc_protos::FullCallstackSample;
using orbit_grpc_protos::FunctionCall;
using orbit_grpc_protos::ProducerCaptureEvent;
using orbit_grpc_protos::SchedulingSlice;
using orbit_grpc_protos::ThreadName;
using orbit_grpc_protos::kWindowsTracingProducerId;
void TracingHandler::Start(CaptureOptions capture_options) {
ORBIT_CHECK(tracer_ == nullptr);
tracer_ = orbit_windows_tracing::Tracer::Create(std::move(capture_options), this);
tracer_->Start();
}
void TracingHandler::Stop() {
ORBIT_CHECK(tracer_ != nullptr);
tracer_->Stop();
tracer_.reset();
ORBIT_LOG("Windows TracingHandler stopped: ETW tracing is done");
}
void TracingHandler::OnSchedulingSlice(SchedulingSlice scheduling_slice) {
ProducerCaptureEvent event;
*event.mutable_scheduling_slice() = std::move(scheduling_slice);
producer_event_processor_->ProcessEvent(kWindowsTracingProducerId, std::move(event));
}
void TracingHandler::OnCallstackSample(FullCallstackSample callstack_sample) {
ProducerCaptureEvent event;
*event.mutable_full_callstack_sample() = std::move(callstack_sample);
producer_event_processor_->ProcessEvent(kWindowsTracingProducerId, std::move(event));
}
void TracingHandler::OnFunctionCall(FunctionCall function_call) {
ProducerCaptureEvent event;
*event.mutable_function_call() = std::move(function_call);
producer_event_processor_->ProcessEvent(kWindowsTracingProducerId, std::move(event));
}
void TracingHandler::OnThreadNamesSnapshot(
orbit_grpc_protos::ThreadNamesSnapshot thread_names_snapshot) {
ProducerCaptureEvent event;
*event.mutable_thread_names_snapshot() = std::move(thread_names_snapshot);
producer_event_processor_->ProcessEvent(kWindowsTracingProducerId, std::move(event));
}
void TracingHandler::OnModuleUpdate(orbit_grpc_protos::ModuleUpdateEvent module_update_event) {
ProducerCaptureEvent event;
*event.mutable_module_update_event() = std::move(module_update_event);
producer_event_processor_->ProcessEvent(kWindowsTracingProducerId, std::move(event));
}
void TracingHandler::OnModulesSnapshot(orbit_grpc_protos::ModulesSnapshot modules_snapshot) {
ProducerCaptureEvent event;
*event.mutable_modules_snapshot() = std::move(modules_snapshot);
producer_event_processor_->ProcessEvent(kWindowsTracingProducerId, std::move(event));
}
void TracingHandler::OnPresentEvent(orbit_grpc_protos::PresentEvent present_event) {
ProducerCaptureEvent event;
*event.mutable_present_event() = std::move(present_event);
producer_event_processor_->ProcessEvent(kWindowsTracingProducerId, std::move(event));
}
} // namespace orbit_windows_capture_service