Skip to content

Commit b75bd27

Browse files
committed
feat: add profiling header and setup for tracepoints
Enable conditional profiling via SConstruct by defining ACL_PROFILE_ENABLE and ACL_PROFILE_LEVEL macros based on build-time environment variables. Also introduce the acl_profile.h header to establish the foundation for upcoming tracepoint instrumentation. Partially Resolves: COMPMID-8330 Signed-off-by: Walid Ben Romdhane <[email protected]> Change-Id: I47ceeacf17dd4762d2cdded2042cebe48173d6e8 Reviewed-on: https://review.mlplatform.org/c/ml/ComputeLibrary/+/14671 Comments-Addressed: Arm Jenkins <[email protected]> Tested-by: Arm Jenkins <[email protected]> Reviewed-by: Gunes Bayir <[email protected]> Benchmark: Arm Jenkins <[email protected]>
1 parent 1562897 commit b75bd27

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

SConstruct

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ def update_data_type_layout_flags(env, data_types, data_layouts):
9292
vars = Variables("scons")
9393
vars.AddVariables(
9494
BoolVariable("debug", "Debug", False),
95+
BoolVariable("profile", "Profile using Perfetto, forces C++17", False),
96+
EnumVariable("profile_level", "Profile level. If not set, defaults to 0", allowed_values=("0", "1", "2"), default="0"),
9597
BoolVariable("asserts", "Enable asserts (this flag is forced to 1 for debug=1)", False),
9698
BoolVariable("logging", "Enable Logging", False),
9799
EnumVariable("arch", "Target Architecture. The x86_32 and x86_64 targets can only be used with neon=0 and opencl=1.", "armv7a",
@@ -250,6 +252,9 @@ env.Append(CXXFLAGS = ['-DARCH_ARM',
250252
if not 'windows' in env['os']:
251253
env.Append(CXXFLAGS = ['-Wall','-std=c++14', '-pedantic' ])
252254

255+
if env['profile']:
256+
env.Append(CXXFLAGS = ['-std=c++17', '-DACL_PROFILE_ENABLE'])
257+
env.Append(CXXFLAGS = ['-DACL_PROFILE_LEVEL=%d' % int(env['profile_level'])])
253258

254259
cpp_tool = {'linux': 'g++', 'android' : 'clang++',
255260
'tizen': 'g++', 'macos':'clang++',
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
* Copyright (c) 2025 Arm Limited.
3+
*
4+
* SPDX-License-Identifier: MIT
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to
8+
* deal in the Software without restriction, including without limitation the
9+
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10+
* sell copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in all
14+
* copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
* SOFTWARE.
23+
*/
24+
25+
#ifndef ACL_SRC_COMMON_UTILS_PROFILE_ACL_PROFILE_H
26+
#define ACL_SRC_COMMON_UTILS_PROFILE_ACL_PROFILE_H
27+
28+
#define ARM_COMPUTE_TRACE_EVENT(category, level, name) \
29+
(void)category; \
30+
(void)name; \
31+
(void)level
32+
#define ARM_COMPUTE_TRACE_EVENT_BEGIN(category, level, name) \
33+
(void)category; \
34+
(void)name; \
35+
(void)level
36+
#define ARM_COMPUTE_TRACE_EVENT_END(category, level) \
37+
(void)category; \
38+
(void)level
39+
#define ARM_COMPUTE_PROFILE_INIT() \
40+
do \
41+
{ \
42+
} while (0)
43+
#define ARM_COMPUTE_PROFILE_STATIC_STORAGE() \
44+
do \
45+
{ \
46+
} while (0)
47+
#define ARM_COMPUTE_PROFILE_FINISH() \
48+
do \
49+
{ \
50+
} while (0)
51+
52+
#endif // ACL_SRC_COMMON_UTILS_PROFILE_ACL_PROFILE_H

0 commit comments

Comments
 (0)