Line data Source code
1 : /**
2 : * Copyright (c) 2025 Huawei Technologies Co., Ltd.
3 : * This program is free software, you can redistribute it and/or modify it under the terms and conditions of
4 : * CANN Open Software License Agreement Version 2.0 (the "License").
5 : * Please refer to the License for details. You may not use this file except in compliance with the License.
6 : * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
7 : * INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
8 : * See LICENSE in the root of the software repository for the full text of the License.
9 : */
10 :
11 : #include "tracer_schedule.h"
12 : #include "adiag_print.h"
13 : #include "adiag_utils.h"
14 : #include "trace_system_api.h"
15 : #include "tracer_mgr_operate.h"
16 :
17 870 : TraStatus TracerScheduleRegister(Tracer *tracer)
18 : {
19 870 : tracer->mgr = (TracerMgr *)AdiagMalloc(sizeof(struct TracerMgr));
20 870 : if (tracer->mgr == NULL) {
21 0 : return TRACE_FAILURE;
22 : }
23 :
24 870 : tracer->mgr->op.tracerInitFunc = TracerScheduleInit;
25 870 : tracer->mgr->op.tracerExitFunc = TracerScheduleExit;
26 870 : tracer->mgr->op.tracerCreateFunc = TracerScheduleObjCreate;
27 870 : tracer->mgr->op.tracerGetFunc = TracerScheduleObjGet;
28 870 : tracer->mgr->op.tracerSubmitFunc = TracerScheduleObjSubmit;
29 870 : tracer->mgr->op.tracerDestroyFunc = TracerScheduleObjDestroy;
30 870 : tracer->mgr->op.tracerSaveFunc = TracerScheduleSave;
31 870 : tracer->mgr->op.tracerReportFunc = TracerScheduleReport;
32 870 : return TRACE_SUCCESS;
33 : }
34 :
35 940 : TraStatus TracerScheduleUnregister(Tracer *tracer)
36 : {
37 940 : if (tracer->mgr == NULL) {
38 76 : return TRACE_SUCCESS;
39 : }
40 864 : tracer->mgr->op.tracerInitFunc = NULL;
41 864 : tracer->mgr->op.tracerExitFunc = NULL;
42 864 : tracer->mgr->op.tracerCreateFunc = NULL;
43 864 : tracer->mgr->op.tracerGetFunc = NULL;
44 864 : tracer->mgr->op.tracerSubmitFunc = NULL;
45 864 : tracer->mgr->op.tracerDestroyFunc = NULL;
46 864 : tracer->mgr->op.tracerSaveFunc = NULL;
47 864 : tracer->mgr->op.tracerReportFunc = NULL;
48 864 : ADIAG_SAFE_FREE(tracer->mgr);
49 864 : return TRACE_SUCCESS;
50 : }
|