2013-03-16 00:48:56 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef PROFILER_FUNCS_H
|
|
|
|
#define PROFILER_FUNCS_H
|
|
|
|
|
|
|
|
#include "mozilla/NullPtr.h"
|
2013-07-30 14:25:31 +00:00
|
|
|
#include <stdint.h>
|
2013-08-24 06:12:51 +00:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
class TimeDuration;
|
|
|
|
class TimeStamp;
|
|
|
|
}
|
2013-03-16 00:48:56 +00:00
|
|
|
|
|
|
|
using mozilla::TimeStamp;
|
|
|
|
using mozilla::TimeDuration;
|
|
|
|
|
2013-08-17 22:50:18 +00:00
|
|
|
struct JSContext;
|
|
|
|
class JSObject;
|
|
|
|
|
2013-03-16 00:48:56 +00:00
|
|
|
// Returns a handle to pass on exit. This can check that we are popping the
|
|
|
|
// correct callstack.
|
|
|
|
inline void* mozilla_sampler_call_enter(const char *aInfo, void *aFrameAddress = NULL,
|
|
|
|
bool aCopy = false, uint32_t line = 0);
|
|
|
|
inline void mozilla_sampler_call_exit(void* handle);
|
|
|
|
inline void mozilla_sampler_add_marker(const char *aInfo);
|
|
|
|
|
2013-03-26 16:34:27 +00:00
|
|
|
void mozilla_sampler_start(int aEntries, double aInterval,
|
2013-05-16 20:31:50 +00:00
|
|
|
const char** aFeatures, uint32_t aFeatureCount,
|
|
|
|
const char** aThreadNameFilters, uint32_t aFilterCount);
|
2013-03-16 00:48:56 +00:00
|
|
|
|
2013-03-25 21:57:28 +00:00
|
|
|
void mozilla_sampler_stop();
|
2013-03-16 00:48:56 +00:00
|
|
|
|
2013-03-25 21:57:28 +00:00
|
|
|
bool mozilla_sampler_is_active();
|
2013-03-16 00:48:56 +00:00
|
|
|
|
2013-03-25 21:57:28 +00:00
|
|
|
void mozilla_sampler_responsiveness(const TimeStamp& time);
|
2013-03-16 00:48:56 +00:00
|
|
|
|
2013-03-25 21:57:28 +00:00
|
|
|
void mozilla_sampler_frame_number(int frameNumber);
|
2013-03-16 00:48:56 +00:00
|
|
|
|
2013-03-25 21:57:28 +00:00
|
|
|
const double* mozilla_sampler_get_responsiveness();
|
2013-03-16 00:48:56 +00:00
|
|
|
|
2013-03-25 21:57:28 +00:00
|
|
|
void mozilla_sampler_save();
|
2013-03-16 00:48:56 +00:00
|
|
|
|
2013-03-25 21:57:28 +00:00
|
|
|
char* mozilla_sampler_get_profile();
|
2013-03-16 00:48:56 +00:00
|
|
|
|
2013-03-25 21:57:28 +00:00
|
|
|
JSObject *mozilla_sampler_get_profile_data(JSContext *aCx);
|
2013-03-16 00:48:56 +00:00
|
|
|
|
2013-03-25 21:57:28 +00:00
|
|
|
const char** mozilla_sampler_get_features();
|
2013-03-16 00:48:56 +00:00
|
|
|
|
2013-05-28 12:03:38 +00:00
|
|
|
void mozilla_sampler_init(void* stackTop);
|
2013-03-16 00:48:56 +00:00
|
|
|
|
2013-03-25 21:57:28 +00:00
|
|
|
void mozilla_sampler_shutdown();
|
2013-03-16 00:48:56 +00:00
|
|
|
|
|
|
|
void mozilla_sampler_print_location1();
|
|
|
|
void mozilla_sampler_print_location2();
|
|
|
|
|
|
|
|
// Lock the profiler. When locked the profiler is (1) stopped,
|
|
|
|
// (2) profile data is cleared, (3) profiler-locked is fired.
|
|
|
|
// This is used to lock down the profiler during private browsing
|
2013-03-25 21:57:28 +00:00
|
|
|
void mozilla_sampler_lock();
|
2013-03-16 00:48:56 +00:00
|
|
|
|
|
|
|
// Unlock the profiler, leaving it stopped and fires profiler-unlocked.
|
2013-03-25 21:57:28 +00:00
|
|
|
void mozilla_sampler_unlock();
|
2013-03-16 00:48:56 +00:00
|
|
|
|
2013-03-29 19:34:49 +00:00
|
|
|
// Register/unregister threads with the profiler
|
2013-05-28 12:03:38 +00:00
|
|
|
bool mozilla_sampler_register_thread(const char* name, void* stackTop);
|
2013-03-29 19:34:49 +00:00
|
|
|
void mozilla_sampler_unregister_thread();
|
|
|
|
|
2013-04-23 17:10:29 +00:00
|
|
|
double mozilla_sampler_time();
|
|
|
|
|
2013-03-16 00:48:56 +00:00
|
|
|
/* Returns true if env var SPS_NEW is set to anything, else false. */
|
|
|
|
extern bool sps_version2();
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|