1 /*
2  * Percepio Trace Recorder Initialization v4.10.3
3  * Copyright 2023 Percepio AB
4  * www.percepio.com
5  *
6  * SPDX-License-Identifier: Apache-2.0
7  *
8  * This file should only be included in a project if there is a need to
9  * initialize the Trace Recorder before main() has been called.
10  * An example of this scenario is if you have a global object instance that has
11  * a constructor that creates an object that should be traced.
12  * This file will make it easier to initiate the recorder correctly.
13  *
14  * Usage:
15  *	Add a call to TraceRecorderInit::Initialize() wherever a traced object is
16  *	created before the Trace Recorder is normally initialized. This will ensure
17  *	the Trace Recorder is initialized only once.
18  *
19  *	Set TRC_CFG_RECORDER_DATA_PTR_INIT to 0 in trcSnapshotConfig.h to ensure
20  *	RecorderInitialized isn't initialized to 0 after the recorder has been
21  *	already initialized.
22  *
23  *	Finally, call vTraceEnable(TRC_START) after hardware is initialized to
24  *	start gathering trace events.
25  */
26 
27 #pragma once
28 
29 class TraceRecorderInit
30 {
31 public:
32 	static bool Initialize();
33 private:
34 	TraceRecorderInit();
35 	~TraceRecorderInit();
36 
37 	bool IsInitialized();
38 };
39