2013-03-15 17:48:56 -07: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
|
|
|
|
|
2013-08-27 19:59:14 -07:00
|
|
|
#include "js/TypeDecls.h"
|
2014-05-30 18:41:11 -07:00
|
|
|
#include "js/ProfilingStack.h"
|
2013-07-30 07:25:31 -07:00
|
|
|
#include <stdint.h>
|
2013-08-23 23:12:51 -07:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
class TimeStamp;
|
|
|
|
}
|
2013-03-15 17:48:56 -07:00
|
|
|
|
2013-09-25 08:28:34 -07:00
|
|
|
class ProfilerBacktrace;
|
2013-07-10 21:27:04 -07:00
|
|
|
class ProfilerMarkerPayload;
|
|
|
|
|
2013-03-15 17:48:56 -07:00
|
|
|
// Returns a handle to pass on exit. This can check that we are popping the
|
|
|
|
// correct callstack.
|
2014-05-30 18:41:11 -07:00
|
|
|
inline void* mozilla_sampler_call_enter(const char *aInfo, js::ProfileEntry::Category aCategory,
|
|
|
|
void *aFrameAddress = nullptr, bool aCopy = false,
|
|
|
|
uint32_t line = 0);
|
|
|
|
|
2013-03-15 17:48:56 -07:00
|
|
|
inline void mozilla_sampler_call_exit(void* handle);
|
2014-05-30 18:41:11 -07:00
|
|
|
|
2013-12-10 13:34:19 -08:00
|
|
|
void mozilla_sampler_add_marker(const char *aInfo,
|
|
|
|
ProfilerMarkerPayload *aPayload = nullptr);
|
2013-03-15 17:48:56 -07:00
|
|
|
|
2013-03-26 09:34:27 -07:00
|
|
|
void mozilla_sampler_start(int aEntries, double aInterval,
|
2013-05-16 13:31:50 -07:00
|
|
|
const char** aFeatures, uint32_t aFeatureCount,
|
|
|
|
const char** aThreadNameFilters, uint32_t aFilterCount);
|
2013-03-15 17:48:56 -07:00
|
|
|
|
2013-03-25 14:57:28 -07:00
|
|
|
void mozilla_sampler_stop();
|
2013-03-15 17:48:56 -07:00
|
|
|
|
2014-02-28 12:16:38 -08:00
|
|
|
bool mozilla_sampler_is_paused();
|
|
|
|
void mozilla_sampler_pause();
|
|
|
|
void mozilla_sampler_resume();
|
|
|
|
|
2013-09-25 08:28:34 -07:00
|
|
|
ProfilerBacktrace* mozilla_sampler_get_backtrace();
|
|
|
|
void mozilla_sampler_free_backtrace(ProfilerBacktrace* aBacktrace);
|
|
|
|
|
2013-03-25 14:57:28 -07:00
|
|
|
bool mozilla_sampler_is_active();
|
2013-03-15 17:48:56 -07:00
|
|
|
|
2014-05-24 09:14:14 -07:00
|
|
|
bool mozilla_sampler_feature_active(const char* aName);
|
|
|
|
|
2013-10-03 01:53:07 -07:00
|
|
|
void mozilla_sampler_responsiveness(const mozilla::TimeStamp& time);
|
2013-03-15 17:48:56 -07:00
|
|
|
|
2013-03-25 14:57:28 -07:00
|
|
|
void mozilla_sampler_frame_number(int frameNumber);
|
2013-03-15 17:48:56 -07:00
|
|
|
|
2013-03-25 14:57:28 -07:00
|
|
|
const double* mozilla_sampler_get_responsiveness();
|
2013-03-15 17:48:56 -07:00
|
|
|
|
2013-03-25 14:57:28 -07:00
|
|
|
void mozilla_sampler_save();
|
2013-03-15 17:48:56 -07:00
|
|
|
|
2013-03-25 14:57:28 -07:00
|
|
|
char* mozilla_sampler_get_profile();
|
2013-03-15 17:48:56 -07:00
|
|
|
|
2013-03-25 14:57:28 -07:00
|
|
|
JSObject *mozilla_sampler_get_profile_data(JSContext *aCx);
|
2013-03-15 17:48:56 -07:00
|
|
|
|
2015-04-01 09:08:34 -07:00
|
|
|
// Make this function easily callable from a debugger in a build without
|
|
|
|
// debugging information (work around http://llvm.org/bugs/show_bug.cgi?id=22211)
|
|
|
|
extern "C" {
|
|
|
|
void mozilla_sampler_save_profile_to_file(const char* aFilename);
|
|
|
|
}
|
2014-04-21 13:48:47 -07:00
|
|
|
|
2013-03-25 14:57:28 -07:00
|
|
|
const char** mozilla_sampler_get_features();
|
2013-03-15 17:48:56 -07:00
|
|
|
|
2013-05-28 05:03:38 -07:00
|
|
|
void mozilla_sampler_init(void* stackTop);
|
2013-03-15 17:48:56 -07:00
|
|
|
|
2013-03-25 14:57:28 -07:00
|
|
|
void mozilla_sampler_shutdown();
|
2013-03-15 17:48:56 -07:00
|
|
|
|
|
|
|
// 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 14:57:28 -07:00
|
|
|
void mozilla_sampler_lock();
|
2013-03-15 17:48:56 -07:00
|
|
|
|
|
|
|
// Unlock the profiler, leaving it stopped and fires profiler-unlocked.
|
2013-03-25 14:57:28 -07:00
|
|
|
void mozilla_sampler_unlock();
|
2013-03-15 17:48:56 -07:00
|
|
|
|
2013-03-29 12:34:49 -07:00
|
|
|
// Register/unregister threads with the profiler
|
2013-05-28 05:03:38 -07:00
|
|
|
bool mozilla_sampler_register_thread(const char* name, void* stackTop);
|
2013-03-29 12:34:49 -07:00
|
|
|
void mozilla_sampler_unregister_thread();
|
|
|
|
|
2014-03-28 13:08:22 -07:00
|
|
|
void mozilla_sampler_sleep_start();
|
|
|
|
void mozilla_sampler_sleep_end();
|
|
|
|
|
2013-04-23 10:10:29 -07:00
|
|
|
double mozilla_sampler_time();
|
2013-10-03 01:53:07 -07:00
|
|
|
double mozilla_sampler_time(const mozilla::TimeStamp& aTime);
|
2013-04-23 10:10:29 -07:00
|
|
|
|
2013-09-27 09:08:45 -07:00
|
|
|
void mozilla_sampler_tracing(const char* aCategory, const char* aInfo,
|
|
|
|
TracingMetadata aMetaData);
|
|
|
|
|
2014-04-22 11:13:00 -07:00
|
|
|
void mozilla_sampler_tracing(const char* aCategory, const char* aInfo,
|
|
|
|
ProfilerBacktrace* aCause,
|
|
|
|
TracingMetadata aMetaData);
|
|
|
|
|
2014-12-18 10:32:53 -08:00
|
|
|
void mozilla_sampler_log(const char *fmt, va_list args);
|
|
|
|
|
2013-03-15 17:48:56 -07:00
|
|
|
#endif
|
|
|
|
|