|
| 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 "mozilla/StandardInteger.h" |
| 11 | +#include "mozilla/TimeStamp.h" |
| 12 | +#include "jsfriendapi.h" |
| 13 | + |
| 14 | +using mozilla::TimeStamp; |
| 15 | +using mozilla::TimeDuration; |
| 16 | + |
| 17 | +// Returns a handle to pass on exit. This can check that we are popping the |
| 18 | +// correct callstack. |
| 19 | +inline void* mozilla_sampler_call_enter(const char *aInfo, void *aFrameAddress = NULL, |
| 20 | + bool aCopy = false, uint32_t line = 0); |
| 21 | +inline void mozilla_sampler_call_exit(void* handle); |
| 22 | +inline void mozilla_sampler_add_marker(const char *aInfo); |
| 23 | + |
| 24 | +void mozilla_sampler_start1(int aEntries, int aInterval, const char** aFeatures, |
| 25 | + uint32_t aFeatureCount); |
| 26 | +void mozilla_sampler_start2(int aEntries, int aInterval, const char** aFeatures, |
| 27 | + uint32_t aFeatureCount); |
| 28 | + |
| 29 | +void mozilla_sampler_stop1(); |
| 30 | +void mozilla_sampler_stop2(); |
| 31 | + |
| 32 | +bool mozilla_sampler_is_active1(); |
| 33 | +bool mozilla_sampler_is_active2(); |
| 34 | + |
| 35 | +void mozilla_sampler_responsiveness1(const TimeStamp& time); |
| 36 | +void mozilla_sampler_responsiveness2(const TimeStamp& time); |
| 37 | + |
| 38 | +void mozilla_sampler_frame_number1(int frameNumber); |
| 39 | +void mozilla_sampler_frame_number2(int frameNumber); |
| 40 | + |
| 41 | +const double* mozilla_sampler_get_responsiveness1(); |
| 42 | +const double* mozilla_sampler_get_responsiveness2(); |
| 43 | + |
| 44 | +void mozilla_sampler_save1(); |
| 45 | +void mozilla_sampler_save2(); |
| 46 | + |
| 47 | +char* mozilla_sampler_get_profile1(); |
| 48 | +char* mozilla_sampler_get_profile2(); |
| 49 | + |
| 50 | +JSObject *mozilla_sampler_get_profile_data1(JSContext *aCx); |
| 51 | +JSObject *mozilla_sampler_get_profile_data2(JSContext *aCx); |
| 52 | + |
| 53 | +const char** mozilla_sampler_get_features1(); |
| 54 | +const char** mozilla_sampler_get_features2(); |
| 55 | + |
| 56 | +void mozilla_sampler_init1(); |
| 57 | +void mozilla_sampler_init2(); |
| 58 | + |
| 59 | +void mozilla_sampler_shutdown1(); |
| 60 | +void mozilla_sampler_shutdown2(); |
| 61 | + |
| 62 | +void mozilla_sampler_print_location1(); |
| 63 | +void mozilla_sampler_print_location2(); |
| 64 | + |
| 65 | +// Lock the profiler. When locked the profiler is (1) stopped, |
| 66 | +// (2) profile data is cleared, (3) profiler-locked is fired. |
| 67 | +// This is used to lock down the profiler during private browsing |
| 68 | +void mozilla_sampler_lock1(); |
| 69 | +void mozilla_sampler_lock2(); |
| 70 | + |
| 71 | +// Unlock the profiler, leaving it stopped and fires profiler-unlocked. |
| 72 | +void mozilla_sampler_unlock1(); |
| 73 | +void mozilla_sampler_unlock2(); |
| 74 | + |
| 75 | +/* Returns true if env var SPS_NEW is set to anything, else false. */ |
| 76 | +extern bool sps_version2(); |
| 77 | + |
| 78 | +#endif |
| 79 | + |
0 commit comments