tools/profiler/GeckoProfilerFunc.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/tools/profiler/GeckoProfilerFunc.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,95 @@
     1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.8 +
     1.9 +#ifndef PROFILER_FUNCS_H
    1.10 +#define PROFILER_FUNCS_H
    1.11 +
    1.12 +#include "mozilla/NullPtr.h"
    1.13 +#include "js/TypeDecls.h"
    1.14 +#include <stdint.h>
    1.15 +
    1.16 +namespace mozilla {
    1.17 +class TimeDuration;
    1.18 +class TimeStamp;
    1.19 +}
    1.20 +
    1.21 +using mozilla::TimeStamp;
    1.22 +using mozilla::TimeDuration;
    1.23 +
    1.24 +class ProfilerBacktrace;
    1.25 +class ProfilerMarkerPayload;
    1.26 +
    1.27 +// Returns a handle to pass on exit. This can check that we are popping the
    1.28 +// correct callstack.
    1.29 +inline void* mozilla_sampler_call_enter(const char *aInfo, void *aFrameAddress = nullptr,
    1.30 +                                        bool aCopy = false, uint32_t line = 0);
    1.31 +inline void  mozilla_sampler_call_exit(void* handle);
    1.32 +void  mozilla_sampler_add_marker(const char *aInfo,
    1.33 +                                 ProfilerMarkerPayload *aPayload = nullptr);
    1.34 +
    1.35 +void mozilla_sampler_start(int aEntries, double aInterval,
    1.36 +                           const char** aFeatures, uint32_t aFeatureCount,
    1.37 +                           const char** aThreadNameFilters, uint32_t aFilterCount);
    1.38 +
    1.39 +void mozilla_sampler_stop();
    1.40 +
    1.41 +bool mozilla_sampler_is_paused();
    1.42 +void mozilla_sampler_pause();
    1.43 +void mozilla_sampler_resume();
    1.44 +
    1.45 +ProfilerBacktrace* mozilla_sampler_get_backtrace();
    1.46 +void mozilla_sampler_free_backtrace(ProfilerBacktrace* aBacktrace);
    1.47 +
    1.48 +bool mozilla_sampler_is_active();
    1.49 +
    1.50 +void mozilla_sampler_responsiveness(const mozilla::TimeStamp& time);
    1.51 +
    1.52 +void mozilla_sampler_frame_number(int frameNumber);
    1.53 +
    1.54 +const double* mozilla_sampler_get_responsiveness();
    1.55 +
    1.56 +void mozilla_sampler_save();
    1.57 +
    1.58 +char* mozilla_sampler_get_profile();
    1.59 +
    1.60 +JSObject *mozilla_sampler_get_profile_data(JSContext *aCx);
    1.61 +
    1.62 +void mozilla_sampler_save_profile_to_file(const char* aFilename);
    1.63 +
    1.64 +const char** mozilla_sampler_get_features();
    1.65 +
    1.66 +void mozilla_sampler_init(void* stackTop);
    1.67 +
    1.68 +void mozilla_sampler_shutdown();
    1.69 +
    1.70 +void mozilla_sampler_print_location1();
    1.71 +void mozilla_sampler_print_location2();
    1.72 +
    1.73 +// Lock the profiler. When locked the profiler is (1) stopped,
    1.74 +// (2) profile data is cleared, (3) profiler-locked is fired.
    1.75 +// This is used to lock down the profiler during private browsing
    1.76 +void mozilla_sampler_lock();
    1.77 +
    1.78 +// Unlock the profiler, leaving it stopped and fires profiler-unlocked.
    1.79 +void mozilla_sampler_unlock();
    1.80 +
    1.81 +// Register/unregister threads with the profiler
    1.82 +bool mozilla_sampler_register_thread(const char* name, void* stackTop);
    1.83 +void mozilla_sampler_unregister_thread();
    1.84 +
    1.85 +void mozilla_sampler_sleep_start();
    1.86 +void mozilla_sampler_sleep_end();
    1.87 +
    1.88 +double mozilla_sampler_time();
    1.89 +double mozilla_sampler_time(const mozilla::TimeStamp& aTime);
    1.90 +
    1.91 +/* Returns true if env var SPS_NEW is set to anything, else false. */
    1.92 +extern bool sps_version2();
    1.93 +
    1.94 +void mozilla_sampler_tracing(const char* aCategory, const char* aInfo,
    1.95 +                             TracingMetadata aMetaData);
    1.96 +
    1.97 +#endif
    1.98 +

mercurial