1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
12 #include "VTuneProfiler.h"
16 #include "BaseProfiler.h"
19 namespace baseprofiler
{
21 VTuneProfiler
* VTuneProfiler::mInstance
= nullptr;
23 void VTuneProfiler::Initialize() {
24 // This is just a 'dirty trick' to find out if the ittnotify DLL was found.
25 // If it wasn't this function always returns 0, otherwise it returns
26 // incrementing numbers, if the library was found this wastes 2 events but
27 // that should be okay.
28 // TODO re-implement here if vtune is needed
29 // __itt_event testEvent =
30 // __itt_event_create("Test event", strlen("Test event"));
31 // testEvent = __itt_event_create("Test event 2", strlen("Test event 2"));
34 // mInstance = new VTuneProfiler();
38 void VTuneProfiler::Shutdown() {}
40 void VTuneProfiler::TraceInternal(const char* aName
, TracingKind aKind
) {
41 // TODO re-implement here if vtune is needed
42 // std::string str(aName);
44 // auto iter = mStrings.find(str);
47 // if (iter != mStrings.end()) {
48 // event = iter->second;
50 // event = __itt_event_create(aName, str.length());
51 // mStrings.insert({str, event});
54 // if (aKind == TRACING_INTERVAL_START || aKind == TRACING_EVENT) {
55 // // VTune will consider starts not matched with an end to be single point
58 // __itt_event_start(event);
60 // __itt_event_end(event);
64 void VTuneProfiler::RegisterThreadInternal(const char* aName
) {
65 // TODO re-implement here if vtune is needed
66 // std::string str(aName);
68 // if (!str.compare("Main Thread (Base Profiler)")) {
69 // // Process main thread.
70 // switch (XRE_GetProcessType()) {
71 // case GeckoProcessType::GeckoProcessType_Default:
72 // __itt_thread_set_name("Main Process");
74 // case GeckoProcessType::GeckoProcessType_Content:
75 // __itt_thread_set_name("Content Process");
77 // case GeckoProcessType::GeckoProcessType_GMPlugin:
78 // __itt_thread_set_name("Plugin Process");
80 // case GeckoProcessType::GeckoProcessType_GPU:
81 // __itt_thread_set_name("GPU Process");
84 // __itt_thread_set_name("Unknown Process");
88 // __itt_thread_set_name(aName);
91 } // namespace baseprofiler
92 } // namespace mozilla