fixed dumping statistics

This commit is contained in:
ALEXks
2025-04-20 21:34:31 +03:00
parent cde49042ae
commit 06980ee344
2 changed files with 23 additions and 13 deletions

View File

@@ -14,13 +14,13 @@
#include "dvm.h" #include "dvm.h"
#include "../DynamicAnalysis/gcov_info.h" #include "../DynamicAnalysis/gcov_info.h"
#include "../DynamicAnalysis/gCov_parser_func.h"
#include "PredictScheme.h" #include "PredictScheme.h"
#include "../Utils/SgUtils.h" #include "../Utils/SgUtils.h"
#include "../DirectiveProcessing/directive_parser.h" #include "../DirectiveProcessing/directive_parser.h"
#include "../Distribution/DvmhDirective.h" #include "../Distribution/DvmhDirective.h"
#include "../GraphLoop/graph_loops_func.h" #include "../GraphLoop/graph_loops_func.h"
#include "../ExpressionTransform/expr_transform.h" #include "../ExpressionTransform/expr_transform.h"
#include "../DirectiveProcessing/directive_parser.h"
#include "../LoopAnalyzer/loop_analyzer.h" #include "../LoopAnalyzer/loop_analyzer.h"
#include "../CFGraph/CFGraph.h" #include "../CFGraph/CFGraph.h"
@@ -208,27 +208,31 @@ void calculateStatsForPredictor(const map<string, vector<FuncInfo*>>& allFuncInf
uint64_t paralle_exec = 0; uint64_t paralle_exec = 0;
uint64_t lines_count = 0; uint64_t lines_count = 0;
if (st->variant() == DVM_PARALLEL_ON_DIR) if (st->variant() == DVM_PARALLEL_ON_DIR)
{ {
auto loop = st->lexNext(); auto loop = st->lexNext();
checkNull(loop, convertFileName(__FILE__).c_str(), __LINE__); checkNull(loop, convertFileName(__FILE__).c_str(), __LINE__);
if (loop->variant() != FOR_NODE) if (loop->variant() != FOR_NODE)
printInternalError(convertFileName(__FILE__).c_str(), __LINE__); printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
calculateForParallelLoop(loop, gcov, paralle_exec, lines_count); if (__gcov_doesThisLineExecuted(byFile.first, loop->lineNumber()))
st = loop->lastNodeOfStmt(); {
calculateForParallelLoop(loop, gcov, paralle_exec, lines_count);
st = loop->lastNodeOfStmt();
parallel_exec_count += paralle_exec; parallel_exec_count += paralle_exec;
count_of_parallel_lines += lines_count; count_of_parallel_lines += lines_count;
__spf_print(1, " PAR LOOP [%d %s] total exec %llu, total exec lines %llu, avg %.16e\n", __spf_print(1, " PAR LOOP [%d %s] total exec %llu, total exec lines %llu, avg %.16e\n",
loop->lineNumber(), byFile.first.c_str(), paralle_exec, lines_count, paralle_exec / (double)lines_count); loop->lineNumber(), byFile.first.c_str(), paralle_exec, lines_count, paralle_exec / (double)lines_count);
}
} }
} }
for (auto st = stat->lexNext(); st != stat->lastNodeOfStmt(); st = st->lexNext()) for (auto st = stat->lexNext(); st != stat->lastNodeOfStmt(); st = st->lexNext())
{ {
if (!isSgExecutableStatement(st) || isDVM_stat(st) || isSPF_stat(st)) if (!isSgExecutableStatement(st) || isDVM_stat(st) || isSPF_stat(st) ||
!__gcov_doesThisLineExecuted(byFile.first, st->lineNumber()))
continue; continue;
int line = st->lineNumber(); int line = st->lineNumber();
@@ -428,6 +432,7 @@ static void parallelDir(const map<DIST::Array*, int>& byPos, SgExpression* spec,
parallel["loops_count"] = loopSymbs.size(); parallel["loops_count"] = loopSymbs.size();
SgStatement* loop = isSgForStmt(st->lexNext()); SgStatement* loop = isSgForStmt(st->lexNext());
if (loop == NULL) if (loop == NULL)
printInternalError(convertFileName(__FILE__).c_str(), __LINE__); printInternalError(convertFileName(__FILE__).c_str(), __LINE__);
SgStatement* lastNode = loop->lastNodeOfStmt(); SgStatement* lastNode = loop->lastNodeOfStmt();
@@ -444,11 +449,13 @@ static void parallelDir(const map<DIST::Array*, int>& byPos, SgExpression* spec,
loop = loop->lexNext(); loop = loop->lexNext();
} }
for (int z = execs.size() - 1; z > 0; --z) for (int z = execs.size() - 1; z > 0; --z)
execs[z] /= execs[z - 1]; if (execs[z - 1] != 0)
execs[z] /= execs[z - 1];
auto& info = getInfo(before, gcov); auto& info = getInfo(before, gcov);
execs[0] /= info.getExecutedCount(); if (info.getExecutedCount())
execs[0] /= info.getExecutedCount();
parallel["iterations_count"] = execs; parallel["iterations_count"] = execs;
@@ -587,6 +594,9 @@ void parseDvmDirForPredictor(const map<tuple<int, string, string>, pair<DIST::Ar
for (auto st = stat->lexNext(); st != stat->lastNodeOfStmt(); st = st->lexNext()) for (auto st = stat->lexNext(); st != stat->lastNodeOfStmt(); st = st->lexNext())
{ {
if (!__gcov_doesThisLineExecuted(byFile.first, st->lineNumber()))
continue;
SgExpression* list; SgExpression* list;
SgExpression* dup; SgExpression* dup;
auto line = 0; auto line = 0;

View File

@@ -1,3 +1,3 @@
#pragma once #pragma once
#define VERSION_SPF "2409" #define VERSION_SPF "2410"