From 61519e72df0b35ee029532509f1d9f52b8c79035 Mon Sep 17 00:00:00 2001 From: Bryan Bernhart Date: Fri, 15 Apr 2022 15:17:18 -0700 Subject: [PATCH] Move trace event phase definitions into header. --- src/gpgmm/TraceEvent.h | 11 +------- src/gpgmm/TraceEventPhase.h | 27 +++++++++++++++++++ .../D3D12EventTraceReplay.cpp | 2 +- 3 files changed, 29 insertions(+), 11 deletions(-) create mode 100644 src/gpgmm/TraceEventPhase.h diff --git a/src/gpgmm/TraceEvent.h b/src/gpgmm/TraceEvent.h index ec30964c8..ba45b5b73 100644 --- a/src/gpgmm/TraceEvent.h +++ b/src/gpgmm/TraceEvent.h @@ -15,6 +15,7 @@ #ifndef GPGMM_TRACEEVENT_H_ #define GPGMM_TRACEEVENT_H_ +#include "gpgmm/TraceEventPhase.h" #include "gpgmm/common/JSONEncoder.h" #include @@ -27,16 +28,6 @@ // clang-format off -// Phase indicates the nature of an event entry. E.g. part of a begin/end pair. -#define TRACE_EVENT_PHASE_BEGIN ('B') -#define TRACE_EVENT_PHASE_END ('E') -#define TRACE_EVENT_PHASE_INSTANT ('i') -#define TRACE_EVENT_PHASE_CREATE_OBJECT ('N') -#define TRACE_EVENT_PHASE_SNAPSHOT_OBJECT ('O') -#define TRACE_EVENT_PHASE_DELETE_OBJECT ('D') -#define TRACE_EVENT_PHASE_METADATA ('M') -#define TRACE_EVENT_PHASE_COUNTER ('C') - // Flags for changing the behavior of TRACE_EVENT_API_ADD_TRACE_EVENT. #define TRACE_EVENT_FLAG_NONE (static_cast(0)) #define TRACE_EVENT_FLAG_HAS_ID (static_cast(1 << 1)) diff --git a/src/gpgmm/TraceEventPhase.h b/src/gpgmm/TraceEventPhase.h new file mode 100644 index 000000000..a723c159d --- /dev/null +++ b/src/gpgmm/TraceEventPhase.h @@ -0,0 +1,27 @@ +// Copyright 2021 The GPGMM Authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#ifndef GPGMM_TRACEEVENTPHASE_H_ + +// Phase indicates the nature of an event entry. E.g. part of a begin/end pair. +# define TRACE_EVENT_PHASE_BEGIN ('B') +# define TRACE_EVENT_PHASE_END ('E') +# define TRACE_EVENT_PHASE_INSTANT ('i') +# define TRACE_EVENT_PHASE_CREATE_OBJECT ('N') +# define TRACE_EVENT_PHASE_SNAPSHOT_OBJECT ('O') +# define TRACE_EVENT_PHASE_DELETE_OBJECT ('D') +# define TRACE_EVENT_PHASE_METADATA ('M') +# define TRACE_EVENT_PHASE_COUNTER ('C') + +#endif // GPGMM_TRACEEVENTPHASE_H_ diff --git a/src/tests/capture_replay_tests/D3D12EventTraceReplay.cpp b/src/tests/capture_replay_tests/D3D12EventTraceReplay.cpp index 434c7394c..c3b76959a 100644 --- a/src/tests/capture_replay_tests/D3D12EventTraceReplay.cpp +++ b/src/tests/capture_replay_tests/D3D12EventTraceReplay.cpp @@ -15,7 +15,7 @@ #include "tests/capture_replay_tests/GPGMMCaptureReplayTests.h" -#include "gpgmm/TraceEvent.h" +#include "gpgmm/TraceEventPhase.h" #include "gpgmm/common/Log.h" #include "gpgmm/common/PlatformTime.h" #include "gpgmm/d3d12/UtilsD3D12.h"