• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) Huawei Technologies Co., Ltd. 2023. All rights reserved.
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 SYSCALL_STDTYPE_H
17 #define SYSCALL_STDTYPE_H
18 #include "base_stdtype.h"
19 
20 namespace SysTuning {
21 namespace TraceStdtype {
22 struct SyscallInfoRow {
23     uint64_t ts = INVALID_UINT64;
24     uint64_t dur = INVALID_UINT64;
25     InternalTid itid = INVALID_UINT32;
26     uint32_t number = INVALID_UINT32;
27     DataIndex args = INVALID_UINT64;
28     int64_t ret = INVALID_INT64;
29 };
30 class SysCall : public CacheBase, public BatchCacheBase {
31 public:
32     size_t AppendSysCallData(const SyscallInfoRow &syscallNrInfoRow);
SysCallNumbersData()33     const std::deque<uint32_t> &SysCallNumbersData() const
34     {
35         return sysCallNumbers_;
36     }
DursData()37     const std::deque<uint64_t> &DursData() const
38     {
39         return durs_;
40     }
ItidsData()41     const std::deque<uint32_t> &ItidsData() const
42     {
43         return itids_;
44     }
ArgsData()45     const std::deque<DataIndex> &ArgsData() const
46     {
47         return args_;
48     }
RetsData()49     const std::deque<int64_t> &RetsData() const
50     {
51         return rets_;
52     }
Clear()53     void Clear() override
54     {
55         CacheBase::Clear();
56         sysCallNumbers_.clear();
57         durs_.clear();
58         itids_.clear();
59         args_.clear();
60         rets_.clear();
61     }
ClearExportedData()62     void ClearExportedData() override
63     {
64         EraseElements(sysCallNumbers_, timeStamps_, durs_, itids_, args_, rets_);
65     }
66 
67 private:
68     std::deque<uint64_t> durs_ = {};
69     std::deque<uint32_t> sysCallNumbers_ = {};
70     std::deque<uint32_t> itids_ = {};
71     std::deque<DataIndex> args_ = {};
72     std::deque<int64_t> rets_ = {};
73 };
74 } // namespace TraceStdtype
75 } // namespace SysTuning
76 #endif // SYSCALL_STDTYPE_H
77