You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
2.1 KiB
69 lines
2.1 KiB
/**
|
|
* Copyright 2019-2020 Huawei Technologies Co., Ltd
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
#include <bits/stdc++.h>
|
|
#include <dirent.h>
|
|
#include <gtest/gtest.h>
|
|
#include <fstream>
|
|
#include <map>
|
|
#include <string>
|
|
|
|
#define protected public
|
|
#define private public
|
|
#include "common/profiling/profiling_manager.h"
|
|
#undef protected
|
|
#undef private
|
|
|
|
using namespace ge;
|
|
using namespace std;
|
|
|
|
class UtestGeProfilinganager : public testing::Test {
|
|
protected:
|
|
void SetUp() override {}
|
|
|
|
void TearDown() override {}
|
|
};
|
|
|
|
TEST_F(UtestGeProfilinganager, init_success) {
|
|
setenv("PROFILING_MODE", "true", true);
|
|
Options options;
|
|
options.device_id = 0;
|
|
options.job_id = "0";
|
|
options.profiling_mode = "1";
|
|
options.profiling_options = R"({"result_path":"/data/profiling","training_trace":"on","task_trace":"on","aicpu_trace":"on","fp_point":"Data_0","bp_point":"addn","ai_core_metrics":"ResourceConflictRatio"})";
|
|
|
|
|
|
struct MsprofGeOptions prof_conf = {{ 0 }};
|
|
|
|
Status ret = ProfilingManager::Instance().InitFromOptions(options, prof_conf);
|
|
EXPECT_EQ(ret, ge::SUCCESS);
|
|
}
|
|
|
|
TEST_F(UtestGeProfilinganager, ParseOptions) {
|
|
setenv("PROFILING_MODE", "true", true);
|
|
Options options;
|
|
options.device_id = 0;
|
|
options.job_id = "0";
|
|
options.profiling_mode = "1";
|
|
options.profiling_options = R"({"result_path":"/data/profiling","training_trace":"on","task_trace":"on","aicpu_trace":"on","fp_point":"Data_0","bp_point":"addn","ai_core_metrics":"ResourceConflictRatio"})";
|
|
|
|
|
|
struct MsprofGeOptions prof_conf = {{ 0 }};
|
|
|
|
Status ret = ProfilingManager::Instance().ParseOptions(options.profiling_options);
|
|
EXPECT_EQ(ret, ge::SUCCESS);
|
|
}
|