fxos: show memory usage after project load
This commit is contained in:
parent
64a3df8e17
commit
7a656c3b3e
|
@ -0,0 +1,25 @@
|
|||
//---------------------------------------------------------------------------//
|
||||
// 1100101 |_ mov #0, r4 __ //
|
||||
// 11 |_ <0xb380 %5c4> / _|_ _____ ___ //
|
||||
// 0110 |_ 3.50 -> 3.60 | _\ \ / _ (_-< //
|
||||
// |_ base# + offset |_| /_\_\___/__/ //
|
||||
//---------------------------------------------------------------------------//
|
||||
// fxos/util/system: System-specific functions
|
||||
|
||||
#ifndef FXOS_UTIL_SYSTEM_H
|
||||
#define FXOS_UTIL_SYSTEM_H
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
static inline long systemGetCurrentRSS()
|
||||
{
|
||||
FILE *fp = fopen("/proc/self/statm", "r");
|
||||
if(!fp)
|
||||
return 0;
|
||||
long rss = 0;
|
||||
int rc = fscanf(fp, "%*s %ld", &rss);
|
||||
fclose(fp);
|
||||
return (rc == 1) ? rss * sysconf(_SC_PAGESIZE) : 0;
|
||||
}
|
||||
|
||||
#endif /* FXOS_UTIL_SYSTEM_H */
|
|
@ -327,6 +327,7 @@ bool Function::exploreFunctionAt(u32 functionAddress)
|
|||
|
||||
/* Sort blocks now before creating CFG nodes, which are index-based */
|
||||
sortBasicBlocks();
|
||||
m_blocks.shrink_to_fit();
|
||||
|
||||
/* Set block predecessors */
|
||||
for(auto &[pc, succ]: successorAddresses) {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#include <fxos/project.h>
|
||||
#include <fxos/util/log.h>
|
||||
#include <fxos/util/Timer.h>
|
||||
#include <fxos/util/system.h>
|
||||
#include <filesystem>
|
||||
#include <algorithm>
|
||||
#include <string>
|
||||
|
@ -197,7 +198,8 @@ bool Project::load(std::string const &path0, bool verbose)
|
|||
|
||||
t.stop();
|
||||
if(verbose)
|
||||
printf("Loaded %s in %s\n", m_name.c_str(), t.format_time().c_str());
|
||||
printf("Loaded %s in %s (%ld MB used)\n", m_name.c_str(),
|
||||
t.format_time().c_str(), systemGetCurrentRSS() / 1000000);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue