tools/profiler/GeckoProfilerFunc.h

branch
TOR_BUG_9701
changeset 15
b8a032363ba2
equal deleted inserted replaced
-1:000000000000 0:69af451c6ae1
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/. */
5
6 #ifndef PROFILER_FUNCS_H
7 #define PROFILER_FUNCS_H
8
9 #include "mozilla/NullPtr.h"
10 #include "js/TypeDecls.h"
11 #include <stdint.h>
12
13 namespace mozilla {
14 class TimeDuration;
15 class TimeStamp;
16 }
17
18 using mozilla::TimeStamp;
19 using mozilla::TimeDuration;
20
21 class ProfilerBacktrace;
22 class ProfilerMarkerPayload;
23
24 // Returns a handle to pass on exit. This can check that we are popping the
25 // correct callstack.
26 inline void* mozilla_sampler_call_enter(const char *aInfo, void *aFrameAddress = nullptr,
27 bool aCopy = false, uint32_t line = 0);
28 inline void mozilla_sampler_call_exit(void* handle);
29 void mozilla_sampler_add_marker(const char *aInfo,
30 ProfilerMarkerPayload *aPayload = nullptr);
31
32 void mozilla_sampler_start(int aEntries, double aInterval,
33 const char** aFeatures, uint32_t aFeatureCount,
34 const char** aThreadNameFilters, uint32_t aFilterCount);
35
36 void mozilla_sampler_stop();
37
38 bool mozilla_sampler_is_paused();
39 void mozilla_sampler_pause();
40 void mozilla_sampler_resume();
41
42 ProfilerBacktrace* mozilla_sampler_get_backtrace();
43 void mozilla_sampler_free_backtrace(ProfilerBacktrace* aBacktrace);
44
45 bool mozilla_sampler_is_active();
46
47 void mozilla_sampler_responsiveness(const mozilla::TimeStamp& time);
48
49 void mozilla_sampler_frame_number(int frameNumber);
50
51 const double* mozilla_sampler_get_responsiveness();
52
53 void mozilla_sampler_save();
54
55 char* mozilla_sampler_get_profile();
56
57 JSObject *mozilla_sampler_get_profile_data(JSContext *aCx);
58
59 void mozilla_sampler_save_profile_to_file(const char* aFilename);
60
61 const char** mozilla_sampler_get_features();
62
63 void mozilla_sampler_init(void* stackTop);
64
65 void mozilla_sampler_shutdown();
66
67 void mozilla_sampler_print_location1();
68 void mozilla_sampler_print_location2();
69
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();
74
75 // Unlock the profiler, leaving it stopped and fires profiler-unlocked.
76 void mozilla_sampler_unlock();
77
78 // Register/unregister threads with the profiler
79 bool mozilla_sampler_register_thread(const char* name, void* stackTop);
80 void mozilla_sampler_unregister_thread();
81
82 void mozilla_sampler_sleep_start();
83 void mozilla_sampler_sleep_end();
84
85 double mozilla_sampler_time();
86 double mozilla_sampler_time(const mozilla::TimeStamp& aTime);
87
88 /* Returns true if env var SPS_NEW is set to anything, else false. */
89 extern bool sps_version2();
90
91 void mozilla_sampler_tracing(const char* aCategory, const char* aInfo,
92 TracingMetadata aMetaData);
93
94 #endif
95

mercurial