1 /* 2 * Copyright (c) 2025 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 MISCSERVICES_PASTEBOARD_DFX_PROCESSOR_EVENT_H 17 #define MISCSERVICES_PASTEBOARD_DFX_PROCESSOR_EVENT_H 18 #include <mutex> 19 20 namespace OHOS { 21 namespace MiscServices { 22 enum EventReportResult : std::int32_t { 23 EVENT_REPORT_SUCCESS = 0, 24 EVENT_REPORT_FAIL = 1, 25 }; 26 27 class DfxAppEvent { 28 public: 29 DfxAppEvent(); 30 ~DfxAppEvent(); 31 static int64_t AddProcessor(); 32 void SetEvent(const std::string &apiName, int32_t errCode, int32_t result); 33 private: 34 static int64_t processorId_; 35 static std::mutex mutex_; 36 int32_t result_ = 1; 37 int32_t errCode_ = -1; 38 int64_t beginTime_ = 0; 39 std::string apiName_; 40 std::string transId_; 41 }; 42 } // namespace MiscServices 43 } // namespace OHOS 44 #endif // MISCSERVICES_PASTEBOARD_DFX_PROCESSOR_EVENT_H