fixed dead code

This commit is contained in:
ALEXks
2024-04-14 21:30:09 +03:00
parent f7406cf729
commit d8bd2ec43a
5 changed files with 116 additions and 17 deletions

View File

@@ -139,6 +139,36 @@ void CStat::init(const char* path) {
strcpy(spath, path);
}
void CStat::init(CStatRead* stat_) {
isjson = false;
if (isinitialized) {
err = true;
return;
}
stat = stat_;
int warn;
if (stat->Valid(&warn) != TRUE) {
err = true;
return;
}
nproc = stat->QProc();
if (nproc == 0) {
err = true;
return;
}
stat->VMSSize(p_heading);
unsigned long n = stat->BeginTreeWalk();
if (n != 0) inter_tree = new CStatInter(stat, n);
proc_info = new struct CProcInfo[nproc];
for (unsigned long i = 0; i < nproc; i++)
stat->NameTimeProc(i, &proc_info[i].node_name, &proc_info[i].test_time);
isinitialized = true;
//TODO: ?
/*spath = new char[strlen(path) + 1];
strcpy(spath, path);*/
}
CStatInter * find_inter(short type, long expr, short nlev, CStatInter * cur) {
while (cur != NULL) {
if (cur->id.t == type && cur->id.nlev == nlev)

View File

@@ -15,6 +15,7 @@
#endif
#include "statprintf.h"
#include "statlist.h"
using namespace std;
/**
@@ -83,6 +84,7 @@ static void printHelp()
printf(" StartShdGrp|WaitShdGrp|ShdGrp|DistrGrp|ReDistrGrp|\n");
printf(" MapPLGrp|DoPLGrp|ProgBlockGrp|IOGrp|RemAccessGrp|\n");
printf(" UserDebGrp|StatistGrp|SystemGrp.\n");
printf(" -j Dump to json format\n");
}
#ifdef __SPF_BUILT_IN_PPPA
@@ -112,7 +114,7 @@ int main(int argv, char **argc)
#endif
}
BOOL proc = TRUE, comp = TRUE, gen = TRUE;
BOOL proc = TRUE, comp = TRUE, gen = TRUE, jsonDump = FALSE;
BOOL dvmh_gpu = TRUE, dvmh_threads = FALSE, dvmh_threads_full = FALSE;
int verbosity = VERBOSITY_LVL_CPU | VERBOSITY_LVL_GPU;
char compr[3], mode[5];
@@ -139,7 +141,7 @@ int main(int argv, char **argc)
exit(1);
#endif
}
if (argv == npar + 1) {
if (argv == npar + 1 && argc[npar][1] != 'j') {
printf("Parameter for %s not set\n", argc[npar]);
#ifdef __SPF_BUILT_IN_PPPA
return 1;
@@ -335,7 +337,9 @@ int main(int argv, char **argc)
else ++buf;
} while (cond);
}
break;
case 'j':
jsonDump = TRUE;
break;
default:
printf("Incorrect parameter %s\n", argc[npar]);
@@ -363,6 +367,27 @@ int main(int argv, char **argc)
#endif
}
if (jsonDump == TRUE)
{
CStat stat_json;
stat_json.init(&stat);
if (!stat_json.isinitialized)
return 1;
json j;
stat_json.to_json(j);
std::string str = j.dump();
FILE* f = fopen(argc[nparout], "w");
if (f == NULL)
{
printf("Can't open file %s\n", argc[nparout]);
return 1;
}
fprintf(f, "%s\n", str.c_str());
fclose(f);
return 0;
}
// Возвращает количество процессоров, на которых считалась задача.
unsigned long qproc = stat.QProc();

View File

@@ -85,7 +85,8 @@ private:
public:
CStat();
CStat(json source);
void init(const char* path) ;
void init(const char* path);
void init(CStatRead* stat);
void clear();
~CStat() ;
CStatInter * inter_tree; //"<22><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>" <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>