Bumping gaia.json for 1 gaia revision(s) a=gaia-bump
[gecko.git] / tools / profiler / GeckoProfilerFunc.h
blob62f2efbc38c2c9e30ae6861b73fe1f3bc282464b
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef PROFILER_FUNCS_H
7 #define PROFILER_FUNCS_H
9 #include "mozilla/NullPtr.h"
10 #include "js/TypeDecls.h"
11 #include "js/ProfilingStack.h"
12 #include <stdint.h>
14 namespace mozilla {
15 class TimeStamp;
18 class ProfilerBacktrace;
19 class ProfilerMarkerPayload;
21 // Returns a handle to pass on exit. This can check that we are popping the
22 // correct callstack.
23 inline void* mozilla_sampler_call_enter(const char *aInfo, js::ProfileEntry::Category aCategory,
24 void *aFrameAddress = nullptr, bool aCopy = false,
25 uint32_t line = 0);
27 inline void mozilla_sampler_call_exit(void* handle);
29 void mozilla_sampler_add_marker(const char *aInfo,
30 ProfilerMarkerPayload *aPayload = nullptr);
32 void mozilla_sampler_start(int aEntries, double aInterval,
33 const char** aFeatures, uint32_t aFeatureCount,
34 const char** aThreadNameFilters, uint32_t aFilterCount);
36 void mozilla_sampler_stop();
38 bool mozilla_sampler_is_paused();
39 void mozilla_sampler_pause();
40 void mozilla_sampler_resume();
42 ProfilerBacktrace* mozilla_sampler_get_backtrace();
43 void mozilla_sampler_free_backtrace(ProfilerBacktrace* aBacktrace);
45 bool mozilla_sampler_is_active();
47 void mozilla_sampler_responsiveness(const mozilla::TimeStamp& time);
49 void mozilla_sampler_frame_number(int frameNumber);
51 const double* mozilla_sampler_get_responsiveness();
53 void mozilla_sampler_save();
55 char* mozilla_sampler_get_profile();
57 JSObject *mozilla_sampler_get_profile_data(JSContext *aCx);
59 void mozilla_sampler_save_profile_to_file(const char* aFilename);
61 const char** mozilla_sampler_get_features();
63 void mozilla_sampler_init(void* stackTop);
65 void mozilla_sampler_shutdown();
67 void mozilla_sampler_print_location1();
68 void mozilla_sampler_print_location2();
70 // Lock the profiler. When locked the profiler is (1) stopped,
71 // (2) profile data is cleared, (3) profiler-locked is fired.
72 // This is used to lock down the profiler during private browsing
73 void mozilla_sampler_lock();
75 // Unlock the profiler, leaving it stopped and fires profiler-unlocked.
76 void mozilla_sampler_unlock();
78 // Register/unregister threads with the profiler
79 bool mozilla_sampler_register_thread(const char* name, void* stackTop);
80 void mozilla_sampler_unregister_thread();
82 void mozilla_sampler_sleep_start();
83 void mozilla_sampler_sleep_end();
85 double mozilla_sampler_time();
86 double mozilla_sampler_time(const mozilla::TimeStamp& aTime);
88 /* Returns true if env var SPS_NEW is set to anything, else false. */
89 extern bool sps_version2();
91 void mozilla_sampler_tracing(const char* aCategory, const char* aInfo,
92 TracingMetadata aMetaData);
94 void mozilla_sampler_tracing(const char* aCategory, const char* aInfo,
95 ProfilerBacktrace* aCause,
96 TracingMetadata aMetaData);
98 #endif