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

@@ -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();