• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 INTERFACES_INNER_API_UNIFIED_COLLECTION_RESOURCE_IO_H
17 #define INTERFACES_INNER_API_UNIFIED_COLLECTION_RESOURCE_IO_H
18 #include <cinttypes>
19 #include <string>
20 
21 namespace OHOS {
22 namespace HiviewDFX {
23 struct ProcessIo {
24     int32_t pid;
25     std::string name;
26     int32_t rchar;
27     int32_t wchar;
28     int32_t syscr;
29     int32_t syscw;
30     int32_t readBytes;
31     int32_t writeBytes;
32     int32_t cancelledWriteBytes;
33 };
34 
35 struct DiskData {
36     uint64_t sectorRead = 0;  /* number of sectors read */
37     uint64_t sectorWrite = 0; /* number of sectors written */
38     uint64_t operRead = 0;    /* number of reads merged */
39     uint64_t operWrite = 0;   /* number of writes merged */
40     uint64_t readTime = 0;    /* number of time spent reading (ms) */
41     uint64_t writeTime = 0;   /* number of time spent writing (ms) */
42     uint64_t ioWait = 0;      /* number of I/Os currently in progress */
43 };
44 
45 struct DiskStats {
46     std::string deviceName;
47     double sectorReadRate = 0.0;  /* number of sectors read persecond */
48     double sectorWriteRate = 0.0; /* number of sectors written persecond */
49     double operReadRate = 0.0;    /* number of reads merged persecond */
50     double operWriteRate = 0.0;   /* number of writes merged persecond */
51     double readTimeRate = 0.0;    /* number of time spent reading (ms) persecond */
52     double writeTimeRate = 0.0;   /* number of time spent writing (ms) persecond */
53     uint64_t ioWait = 0;        /* number of I/Os currently in progress */
54 };
55 
56 struct DiskStatsDevice {
57     DiskData preData;
58     DiskStats stats;
59     uint64_t collectTime = 0;
60 };
61 
62 struct EMMCInfo {
63     std::string name;
64     std::string manfid;
65     std::string csd;
66     std::string type;
67     int64_t size;
68 };
69 
70 struct ProcessIoStats {
71     int32_t pid;
72     std::string name;
73     int32_t ground;
74     double rcharRate;
75     double wcharRate;
76     double syscrRate;
77     double syscwRate;
78     double readBytesRate;
79     double writeBytesRate;
80 };
81 
82 struct SysIoStats {
83     double rcharRate = 0.0;
84     double wcharRate = 0.0;
85     double syscrRate = 0.0;
86     double syscwRate = 0.0;
87     double readBytesRate = 0.0;
88     double writeBytesRate = 0.0;
89 };
90 
91 struct ProcessIoStatsInfo {
92     ProcessIo preData;
93     ProcessIoStats stats;
94     uint64_t collectTime = 0;
95 };
96 } // HiviewDFX
97 } // OHOS
98 #endif // INTERFACES_INNER_API_UNIFIED_COLLECTION_RESOURCE_IO_H