tools/profiler/GeckoProfilerFunc.h

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

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

mercurial