1 /* 2 * Copyright (C) 2023 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 NETWORK_H 17 #define NETWORK_H 18 #include "sp_profiler.h" 19 namespace OHOS { 20 namespace SmartPerf { 21 class Network : public SpProfiler { 22 public: 23 std::map<std::string, std::string> ItemData() override; GetInstance()24 static Network &GetInstance() 25 { 26 static Network instance; 27 return instance; 28 } 29 std::map<std::string, std::string> GetNetworkInfo(); 30 31 private: Network()32 Network() {}; 33 Network(const Network &); 34 Network &operator = (const Network &); 35 long long allTx = 0; 36 long long allRx = 0; 37 long long curTx = 0; 38 long long curRx = 0; 39 long long diffTx = 0; 40 long long diffRx = 0; 41 long long prevTx = 0; 42 long long prevRx = 0; 43 bool isFirst = true; 44 }; 45 } 46 } 47 #endif // NETWORK_H 48