Skip to content

Commit

Permalink
OTS Statistics by kondra - CLangFormat
Browse files Browse the repository at this point in the history
  • Loading branch information
gesior committed Dec 14, 2024
1 parent 1851582 commit a6e9fbf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ static bool executeQuery(tfs::detail::Mysql_ptr& handle, std::string_view query,
}

#ifdef STATS_ENABLED
uint64_t ns = std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now() - time_point).count();
uint64_t ns =
std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now() - time_point)
.count();
std::string statsQuery = {query.begin(), query.end()};
g_stats.addSqlStats(new Stat(ns, statsQuery.substr(0, 100), statsQuery.substr(0, 256)));
#endif
Expand Down
8 changes: 5 additions & 3 deletions src/stats.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Task;
struct Stat
{
Stat(uint64_t _executionTime, const std::string& _description, const std::string& _extraDescription) :
executionTime(_executionTime), description(_description), extraDescription(_extraDescription){};
executionTime(_executionTime), description(_description), extraDescription(_extraDescription) {};
uint64_t executionTime = 0;
std::string description;
std::string extraDescription;
Expand Down Expand Up @@ -98,8 +98,10 @@ class AutoStatRecursive : public AutoStat
{
assert(activeStat == this);
activeStat = parent;
if(activeStat)
activeStat->minusTime += std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now() - time_point).count();
if (activeStat)
activeStat->minusTime += std::chrono::duration_cast<std::chrono::nanoseconds>(
std::chrono::high_resolution_clock::now() - time_point)
.count();
}

private:
Expand Down

0 comments on commit a6e9fbf

Please sign in to comment.