Skip to content
Snippets Groups Projects
Commit ed090fb4 authored by Hashim Sharif's avatar Hashim Sharif
Browse files

BugFix: Adding checks for global_knobs.txt existence

parent 68743c31
No related branches found
No related tags found
No related merge requests found
...@@ -24,16 +24,20 @@ PerfParams::PerfParams(int row1, int col1, int skip_offset1) { ...@@ -24,16 +24,20 @@ PerfParams::PerfParams(int row1, int col1, int skip_offset1) {
PerfParamSet::PerfParamSet() { PerfParamSet::PerfParamSet() {
//printf("- knobs_file_path = %s \n", GLOBAL_KNOBS_FILE); printf("- knobs_file_path = %s \n", GLOBAL_KNOBS_FILE);
std::ifstream file(GLOBAL_KNOBS_FILE); std::ifstream file(GLOBAL_KNOBS_FILE);
if (!file){
ERROR(" Could NOT find global_knobs.txt \n");
}
std::string line; std::string line;
std::string partial; std::string partial;
std::vector<std::string> tokens; std::vector<std::string> tokens;
while (std::getline(file, line)) { // Read each line while (std::getline(file, line)) { // Read each line
// printf ("***** line === %s ", line); //printf ("***** line === %s ", line);
std::istringstream iss(line); std::istringstream iss(line);
std::string token; std::string token;
while (std::getline(iss, token, '\t')) { // Read each token in the line while (std::getline(iss, token, '\t')) { // Read each token in the line
...@@ -94,9 +98,13 @@ SampParams::SampParams(int skip_rate1, int skip_offset1, ...@@ -94,9 +98,13 @@ SampParams::SampParams(int skip_rate1, int skip_offset1,
SampParamSet::SampParamSet() { SampParamSet::SampParamSet() {
//printf("- knobs_file_path = %s \n", GLOBAL_KNOBS_FILE); printf("- knobs_file_path = %s \n", GLOBAL_KNOBS_FILE);
std::ifstream file(GLOBAL_KNOBS_FILE); std::ifstream file(GLOBAL_KNOBS_FILE);
if (!file){
ERROR("Could NOT find global_knobs.txt \n");
}
std::string line; std::string line;
std::string partial; std::string partial;
std::vector<std::string> tokens; std::vector<std::string> tokens;
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#define LOG_DEBUG 0 // Sets the debug logging to true #define LOG_DEBUG 0 // Sets the debug logging to true
#define LOG_INFO 1 // Sets the info logging to true #define LOG_INFO 1 // Sets the info logging to true
#define LOG_ERROR 1 // Print Errors
#define ASSERT_FLAG // Sets assertions to true (opposite of NDEBUG macro) #define ASSERT_FLAG // Sets assertions to true (opposite of NDEBUG macro)
#include "debug.h" #include "debug.h"
...@@ -35,7 +36,7 @@ void DEBUG(const char *format, ...) { ...@@ -35,7 +36,7 @@ void DEBUG(const char *format, ...) {
} }
void ERROR(const char *format, ...) { void ERROR(const char *format, ...) {
if (!LOG_DEBUG) // Don't print if logging info is disabled if (!LOG_ERROR) // Don't print if logging info is disabled
return; return;
va_list args; va_list args;
va_start(args, format); va_start(args, format);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment