1 /*
2  * Copyright (C) 2021 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 #ifndef SADUMPER_H
16 #define SADUMPER_H
17 #include <iservice_registry.h>
18 #include <mutex>
19 #include "hidumper_executor.h"
20 
21 namespace OHOS {
22 namespace HiviewDFX {
23 class SADumper : public HidumperExecutor {
24 public:
25     SADumper(void);
26     ~SADumper(void);
27 
28 public:
29     virtual DumpStatus PreExecute(const std::shared_ptr<DumperParameter> &parameter, StringMatrix dumpDatas) override;
30     virtual DumpStatus Execute() override;
31     virtual DumpStatus AfterExecute() override;
32     using StringVector = std::vector<std::string>;
33     using U16StringVector = std::vector<std::u16string>;
34 
35 private:
36     StringMatrix result_;
37     StringVector names_;
38     U16StringVector args_;
39     std::mutex mutex_;
40     std::string argsStr_;
41     int outputFd_ = -1;
42 
43     DumpStatus GetData(const std::string &name, const sptr<ISystemAbilityManager> &sam);
44 };
45 } // namespace HiviewDFX
46 } // namespace OHOS
47 
48 #endif // End of SADUMPER_H
49