Bug 1646266 - ProfilerMarkers skeleton files - r=gregtatum

This patch introduces all new files that contain the new markers C++ API and implementation.
They are mostly empty at this time, only including each other as eventually needed, and with `#ifdef MOZ_GECKO_PROFILER` guards.

Rough inclusion diagram: (header <-- includer)

    BaseProfilerMarkerPrerequesites.h <-- ProfilerMarkerPrerequesites.h  (Useful types: Input string view, marker options)
                  ^                                    ^
       BaseProfilerMarkerDetail.h     <--    ProfilerMarkerDetail.h      (Implementation details)
                  ^                                    ^
         BaseProfilerMarkers.h        <--      ProfilerMarkers.h         (Main API)
                  ^      ^---------                    ^   ^---------
       BaseProfilerMarkerTypes.h  |   <--    ProfilerMarkerTypes.h   |   (Common marker types)
                  ^         BaseProfiler.h        <--         GeckoProfiler.h  (Existing main profiler headers)

Differential Revision: https://phabricator.services.mozilla.com/D87241
This commit is contained in:
Gerald Squelart 2020-09-02 03:55:43 +00:00
parent 9027b60d6b
commit e91236469e
13 changed files with 188 additions and 3 deletions

View File

@ -0,0 +1,6 @@
/* -*- 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/. */
#include "mozilla/BaseProfilerMarkers.h"

View File

@ -26,6 +26,7 @@ if CONFIG['MOZ_GECKO_PROFILER']:
'core/ProfiledThreadData.cpp',
'core/ProfilerBacktrace.cpp',
'core/ProfilerMarkerPayload.cpp',
'core/ProfilerMarkers.cpp',
'core/ProfilingCategory.cpp',
'core/ProfilingStack.cpp',
'core/RegisteredThread.cpp',
@ -82,6 +83,10 @@ EXPORTS.mozilla += [
'public/BaseProfileJSONWriter.h',
'public/BaseProfilerCounts.h',
'public/BaseProfilerDetail.h',
'public/BaseProfilerMarkers.h',
'public/BaseProfilerMarkersDetail.h',
'public/BaseProfilerMarkersPrerequisites.h',
'public/BaseProfilerMarkerTypes.h',
'public/BlocksRingBuffer.h',
'public/leb128iterator.h',
'public/ModuloBuffer.h',

View File

@ -19,12 +19,16 @@
// This file is safe to include unconditionally, and only defines
// empty macros if MOZ_GECKO_PROFILER is not set.
// BaseProfilerCounts.h is also safe to include unconditionally, with empty
// macros if MOZ_GECKO_PROFILER is not set.
// These headers are also safe to include unconditionally, with empty macros if
// MOZ_GECKO_PROFILER is not set.
#include "mozilla/BaseProfilerCounts.h"
// BaseProfilerMarkers.h is #included in the middle of this header!
// #include "mozilla/BaseProfilerMarkers.h"
#ifndef MOZ_GECKO_PROFILER
# include "mozilla/BaseProfilerMarkers.h"
# include "mozilla/UniquePtr.h"
// This file can be #included unconditionally. However, everything within this
@ -676,6 +680,16 @@ class MOZ_RAII AutoProfilerStats {
# endif // PROFILER_RUNTIME_STATS else
} // namespace baseprofiler
} // namespace mozilla
// BaseProfilerMarkers.h requires some stuff from this header.
// TODO: Move common stuff to shared header, and move this #include to the top.
# include "mozilla/BaseProfilerMarkers.h"
namespace mozilla {
namespace baseprofiler {
//---------------------------------------------------------------------------
// Put profiling data into the profiler (labels and markers)
//---------------------------------------------------------------------------

View File

@ -0,0 +1,16 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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 BaseProfilerMarkerTypes_h
#define BaseProfilerMarkerTypes_h
#include "mozilla/BaseProfilerMarkers.h"
#ifdef MOZ_GECKO_PROFILER
#endif // MOZ_GECKO_PROFILER
#endif // BaseProfilerMarkerTypes_h

View File

@ -0,0 +1,18 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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 BaseProfilerMarkers_h
#define BaseProfilerMarkers_h
#include "mozilla/BaseProfilerMarkersDetail.h"
#ifndef MOZ_GECKO_PROFILER
#else // ndef MOZ_GECKO_PROFILER
#endif // nfed MOZ_GECKO_PROFILER else
#endif // BaseProfilerMarkers_h

View File

@ -0,0 +1,20 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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 BaseProfilerMarkersDetail_h
#define BaseProfilerMarkersDetail_h
#ifndef BaseProfilerMarkers_h
# error "This header should only be #included by BaseProfilerMarkers.h"
#endif
#include "mozilla/BaseProfilerMarkersPrerequisites.h"
#ifdef MOZ_GECKO_PROFILER
#endif // MOZ_GECKO_PROFILER
#endif // BaseProfilerMarkersDetail_h

View File

@ -0,0 +1,14 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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 BaseProfilerMarkersPrerequisites_h
#define BaseProfilerMarkersPrerequisites_h
#ifdef MOZ_GECKO_PROFILER
#endif // MOZ_GECKO_PROFILER
#endif // BaseProfilerMarkersPrerequisites_h

View File

@ -139,6 +139,10 @@ EXPORTS.mozilla += [
'public/ProfileJSONWriter.h',
# vm/GeckoProfiler.h needs to include this and doesn't like #include "ProfilerCounts.h"
'public/ProfilerCounts.h',
'public/ProfilerMarkers.h',
'public/ProfilerMarkersDetail.h',
'public/ProfilerMarkersPrerequisites.h',
'public/ProfilerMarkerTypes.h',
]
if CONFIG['MOZ_VTUNE']:

View File

@ -18,10 +18,15 @@
// everything in here is also safe to include unconditionally, and only defines
// empty macros if MOZ_GECKO_PROFILER is unset
#include "BaseProfiler.h"
#include "mozilla/ProfilerCounts.h"
// ProfilerMarkers.h is #included in the middle of this header!
// #include "mozilla/ProfilerMarkers.h"
#ifndef MOZ_GECKO_PROFILER
# include "mozilla/ProfilerMarkers.h"
# include "mozilla/UniquePtr.h"
// This file can be #included unconditionally. However, everything within this
@ -93,7 +98,6 @@ static inline bool profiler_capture_backtrace(
#else // !MOZ_GECKO_PROFILER
# include "BaseProfiler.h"
# include "js/AllocationRecording.h"
# include "js/ProfilingFrameIterator.h"
# include "js/ProfilingStack.h"
@ -735,6 +739,10 @@ struct ProfilerBufferInfo {
// buffer is being written to, and how much data is visible.
mozilla::Maybe<ProfilerBufferInfo> profiler_get_buffer_info();
// ProfilerMarkers.h requires some stuff from this header.
// TODO: Move common stuff to shared header, and move this #include to the top.
# include "mozilla/ProfilerMarkers.h"
//---------------------------------------------------------------------------
// Put profiling data into the profiler (labels and markers)
//---------------------------------------------------------------------------

View File

@ -0,0 +1,17 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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 ProfilerMarkerTypes_h
#define ProfilerMarkerTypes_h
#include "mozilla/BaseProfilerMarkerTypes.h"
#include "mozilla/ProfilerMarkers.h"
#ifdef MOZ_GECKO_PROFILER
#endif // MOZ_GECKO_PROFILER
#endif // ProfilerMarkerTypes_h

View File

@ -0,0 +1,19 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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 ProfilerMarkers_h
#define ProfilerMarkers_h
#include "mozilla/BaseProfilerMarkers.h"
#include "mozilla/ProfilerMarkersDetail.h"
#ifndef MOZ_GECKO_PROFILER
#else // ndef MOZ_GECKO_PROFILER
#endif // nfed MOZ_GECKO_PROFILER else
#endif // ProfilerMarkers_h

View File

@ -0,0 +1,28 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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 ProfilerMarkersDetail_h
#define ProfilerMarkersDetail_h
#ifndef ProfilerMarkers_h
# error "This header should only be #included by ProfilerMarkers.h"
#endif
#include "mozilla/ProfilerMarkersPrerequisites.h"
#ifdef MOZ_GECKO_PROFILER
// ~~ HERE BE DRAGONS ~~
//
// Everything below is internal implementation detail, you shouldn't need to
// look at it unless working on the profiler code.
// Header that specializes the (de)serializers for xpcom types.
# include "mozilla/ProfileBufferEntrySerializationGeckoExtensions.h"
#endif // MOZ_GECKO_PROFILER
#endif // ProfilerMarkersDetail_h

View File

@ -0,0 +1,16 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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 ProfilerMarkersPrerequisites_h
#define ProfilerMarkersPrerequisites_h
#include "mozilla/BaseProfilerMarkersPrerequisites.h"
#ifdef MOZ_GECKO_PROFILER
#endif // MOZ_GECKO_PROFILER
#endif // ProfilerMarkersPrerequisites_h