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 #include <iostream>
16 #include <sstream>
17 #include "include/sp_utils.h"
18 #include "include/Dubai.h"
19 namespace OHOS {
20 namespace SmartPerf {
21
DumpDubaiBegin()22 void Dubai::DumpDubaiBegin()
23 {
24 std::string result;
25 SPUtils::LoadCmd("hidumper -s 1213 -a '-b'", result);
26 }
DumpDubaiFinish()27 void Dubai::DumpDubaiFinish()
28 {
29 std::string result;
30 SPUtils::LoadCmd("hidumper -s 1213 -a '-f'", result);
31 }
32
MoveDubaiDb()33 void Dubai::MoveDubaiDb()
34 {
35 std::string result;
36 const std::string dubaiName = "dubai.db";
37 const std::string dubaiPath = "/data/system_ce/0/dubai/" + dubaiName;
38 const std::string devicePath = "/data/app/el2/100/database/com.ohos.smartperf/entry/rdb";
39 SPUtils::LoadCmd("rm -rf " + devicePath + "/dubai.*", result);
40 SPUtils::LoadCmd("cp " + dubaiPath + " " + devicePath, result);
41 SPUtils::LoadCmd("chmod 777 " + devicePath + "/" + dubaiName, result);
42 }
43 }
44 }
45