• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef _TRACE_TRACE_MARKER_H
17 #define _TRACE_TRACE_MARKER_H
18 
19 #include <stdint.h>
20 
21 #define TRACE_MARKER_MESSAGE_LEN 1024
22 
23 #ifdef __cplusplus
24 extern "C"
25 {
26 #endif
27 
28 static const uint64_t HITRACE_TAG_ALWAYS = (1ULL << 0); // This tag is always enabled.
29 static const uint64_t HITRACE_TAG_MUSL = (1ULL << 12); // musl tag.
30 
31 /**
32   * @brief Reset trace_marker trace switch status
33   */
34 void trace_marker_reset(void);
35 
36 /**
37   * @brief Write the function call information to the trace_marker node in kernel space,
38   *        used on the same thread as trace_marker_end(),with the symbol "B".
39   * @param label The tagLabel of current sub-system.
40   * @param message The function of information.
41   * @param value The value which want to trace.
42   */
43 void trace_marker_begin(uint64_t label, const char *message, const char *value);
44 
45 /**
46   * @brief Write the terminator to the trace_marker node of the kernel space,
47   *        used on the same thread as trace_marker_begin(),with the symbol "E".
48   * @param label The tagLabel of current sub-system.
49   */
50 void trace_marker_end(uint64_t label);
51 
52 /**
53   * @brief Write the function call information to the trace_marker node in kernel space,
54   *        used in a different thread than trace_marker_async_end(),with the symbol "S".
55   * @param label The tagLabel of current sub-system.
56   * @param message The function of information.
57   * @param value The value which want to trace.
58   */
59 void trace_marker_async_begin(uint64_t label, const char *message, const char *value, int taskId);
60 
61 /**
62   * @brief Write the terminator to the trace_marker node in kernel space,
63   *        used in a different thread than trace_marker_async_begin(),with the symbol "F".
64   * @param label The tagLabel of current sub-system.
65   * @param message The function of information.
66   * @param value The value which want to trace.
67   */
68 void trace_marker_async_end(uint64_t label, const char *message, const char *value, int taskId);
69 
70 /**
71   * @brief Marks a pre-traced numeric variable,with the symbol "C".
72   * @param label The tagLabel of current sub-system.
73   * @param message The function of information.
74   * @param value The value which want to trace.
75   */
76 void trace_marker_count(uint64_t label, const char *message, int value);
77 
78 #ifdef __cplusplus
79 }
80 #endif
81 #endif
82