parent
643053c409
commit
5d493a6493
|
@ -54,7 +54,7 @@ namespace blt::profiling {
|
||||||
bool averageHistory = false
|
bool averageHistory = false
|
||||||
);
|
);
|
||||||
|
|
||||||
void writeProfile(std::ofstream& out, const std::string& profileName);
|
void writeProfile(std::ofstream& out, const std::string& profileName, bool averageHistory = false);
|
||||||
|
|
||||||
void discardProfiles();
|
void discardProfiles();
|
||||||
|
|
||||||
|
|
|
@ -26,10 +26,10 @@ namespace blt::profiling {
|
||||||
difference(difference), name(std::move(name)) {}
|
difference(difference), name(std::move(name)) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
inline void print(const std::vector<std::string>& lines, logging::LOG_LEVEL level) {
|
inline void println(const std::vector<std::string>&& lines, logging::LOG_LEVEL level) {
|
||||||
auto& logger = logging::getLoggerFromLevel(level);
|
auto& logger = logging::getLoggerFromLevel(level);
|
||||||
for (const auto& line : lines)
|
for (const auto& line : lines)
|
||||||
logger << line;
|
logger << line << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -84,8 +84,18 @@ namespace blt::profiling {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void writeProfile(std::ofstream& out, const std::string& profileName, bool ordered) {
|
void writeProfile(std::ofstream& out, const std::string& profileName, bool averageHistory) {
|
||||||
|
auto& profile = profiles[profileName];
|
||||||
|
const auto& intervals = profile.intervals;
|
||||||
|
const auto& points = profile.points;
|
||||||
|
|
||||||
|
std::vector<IntervalComparable> ordered_vector;
|
||||||
|
std::unordered_map<std::string, capture_interval> averaged_intervals;
|
||||||
|
|
||||||
|
if (averageHistory)
|
||||||
|
averageIntervals(profile.historicalIntervals, averaged_intervals);
|
||||||
|
|
||||||
|
orderIntervals(averageHistory ? averaged_intervals : intervals, ordered_vector);
|
||||||
}
|
}
|
||||||
|
|
||||||
void printProfile(
|
void printProfile(
|
||||||
|
@ -116,13 +126,8 @@ namespace blt::profiling {
|
||||||
std::to_string((double)interval.difference / 1000000.0)}
|
std::to_string((double)interval.difference / 1000000.0)}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::string> updatedLines;
|
println(formatter.createTable(true, true), loggingLevel);
|
||||||
const auto& lines = formatter.createTable(true, true);
|
|
||||||
for (const auto& line : lines)
|
|
||||||
updatedLines.emplace_back(line + "\n");
|
|
||||||
|
|
||||||
print(updatedLines, loggingLevel);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- small helper functions below ---
|
// --- small helper functions below ---
|
||||||
|
|
Loading…
Reference in New Issue