Commit 7f9b6e47 authored by Gauthier Quesnel's avatar Gauthier Quesnel
Browse files

gui: show memory usage of external sources

parent 0264d282
Pipeline #31221 passed with stage
in 1 minute and 41 seconds
......@@ -536,6 +536,25 @@ show_random()
}
}
static void
size_in_bytes(const sources& src) noexcept
{
constexpr sz K = 1024u;
constexpr sz M = K * 1024u;
constexpr sz G = M * 1024u;
const sz c = src.csts.size() * sizeof(irt::source::constant) +
src.bins.size() * sizeof(irt::source::binary_file) +
src.texts.size() * sizeof(irt::source::text_file);
if (c / G > 0)
ImGui::Text("Memory usage: %f Gb", ((double)c / (double)G));
else if (c / M > 0)
ImGui::Text("Memory usage: %f Mb", ((double)c / (double)M));
else
ImGui::Text("Memory usage: %f Kb", ((double)c / (double)K));
}
void
sources::show(bool* is_show)
{
......@@ -738,6 +757,8 @@ sources::show(bool* is_show)
}
}
size_in_bytes(*this);
ImGui::End();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment