Change seconds for milliseconds in sample

change path of coverage report in build
This commit is contained in:
2023-03-12 11:27:02 +01:00
parent 4492252729
commit 083a56b311
3 changed files with 8 additions and 7 deletions

View File

@@ -41,4 +41,4 @@ jobs:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: | run: |
sonar-scanner --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}" \ sonar-scanner --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}" \
--define sonar.coverageReportPaths=tests/coverage.xml --define sonar.coverageReportPaths=coverage.xml

View File

@@ -2,5 +2,6 @@
"sonarlint.connectedMode.project": { "sonarlint.connectedMode.project": {
"connectionId": "sonarcloud", "connectionId": "sonarcloud",
"projectKey": "rmontanana_mdlp" "projectKey": "rmontanana_mdlp"
} },
"C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools"
} }

View File

@@ -121,25 +121,25 @@ void process_file(string path, string file_name, bool class_last, int max_depth,
void process_all_files(map<string, bool> datasets, string path, int max_depth, int min_length) void process_all_files(map<string, bool> datasets, string path, int max_depth, int min_length)
{ {
cout << "Results: " << "Max_depth: " << max_depth << " Min_length: " << min_length << endl << endl; cout << "Results: " << "Max_depth: " << max_depth << " Min_length: " << min_length << endl << endl;
printf("%-20s %4s %4s\n", "Dataset", "Feat", "Cuts Time(s)"); printf("%-20s %4s %4s\n", "Dataset", "Feat", "Cuts Time(ms)");
printf("==================== ==== ==== =======\n"); printf("==================== ==== ==== ========\n");
for (auto dataset : datasets) { for (auto dataset : datasets) {
ArffFiles file; ArffFiles file;
file.load(path + dataset.first + ".arff", dataset.second); file.load(path + dataset.first + ".arff", dataset.second);
auto attributes = file.getAttributes(); auto attributes = file.getAttributes();
vector<samples_t>& X = file.getX(); vector<samples_t>& X = file.getX();
labels_t& y = file.getY(); labels_t& y = file.getY();
float timing = 0; size_t timing = 0;
int cut_points = 0; int cut_points = 0;
for (auto i = 0; i < attributes.size(); i++) { for (auto i = 0; i < attributes.size(); i++) {
mdlp::CPPFImdlp test = mdlp::CPPFImdlp(min_length, max_depth); mdlp::CPPFImdlp test = mdlp::CPPFImdlp(min_length, max_depth);
std::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now(); std::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now();
test.fit(X[i], y); test.fit(X[i], y);
std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now(); std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now();
timing += std::chrono::duration_cast<std::chrono::seconds>(end - begin).count(); timing += std::chrono::duration_cast<std::chrono::milliseconds>(end - begin).count();
cut_points += test.getCutPoints().size(); cut_points += test.getCutPoints().size();
} }
printf("%-20s %4lu %4d %7.2f\n", dataset.first.c_str(), attributes.size(), cut_points, timing); printf("%-20s %4lu %4d %8zu\n", dataset.first.c_str(), attributes.size(), cut_points, timing);
} }
} }