mirror of
https://github.com/YosysHQ/yosys
synced 2025-06-19 12:23:39 +00:00
parent
7d076f071e
commit
1167538d26
5 changed files with 9 additions and 52 deletions
|
@ -34,17 +34,12 @@
|
|||
#include <limits.h>
|
||||
#include <errno.h>
|
||||
|
||||
#if defined (__linux__) || defined(__FreeBSD__)
|
||||
#ifdef __linux__
|
||||
# include <sys/resource.h>
|
||||
# include <sys/types.h>
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
# include <sys/sysctl.h>
|
||||
# include <sys/user.h>
|
||||
#endif
|
||||
|
||||
#if !defined(_WIN32) || defined(__MINGW32__)
|
||||
# include <unistd.h>
|
||||
#else
|
||||
|
@ -515,7 +510,7 @@ int main(int argc, char **argv)
|
|||
#else
|
||||
std::string meminfo;
|
||||
std::string stats_divider = ", ";
|
||||
# if defined(__linux__)
|
||||
# ifdef __linux__
|
||||
std::ifstream statm;
|
||||
statm.open(stringf("/proc/%lld/statm", (long long)getpid()));
|
||||
if (statm.is_open()) {
|
||||
|
@ -526,19 +521,6 @@ int main(int argc, char **argv)
|
|||
sz_resident * (getpagesize() / 1024.0 / 1024.0));
|
||||
stats_divider = "\n";
|
||||
}
|
||||
# elif defined(__FreeBSD__)
|
||||
pid_t pid = getpid();
|
||||
int mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PID, (int)pid};
|
||||
struct kinfo_proc kip;
|
||||
size_t kip_len = sizeof(kip);
|
||||
if (sysctl(mib, 4, &kip, &kip_len, NULL, 0) == 0) {
|
||||
vm_size_t sz_total = kip.ki_size;
|
||||
segsz_t sz_resident = kip.ki_rssize;
|
||||
meminfo = stringf(", MEM: %.2f MB total, %.2f MB resident",
|
||||
(int)sz_total / 1024.0 / 1024.0,
|
||||
(int)sz_resident * (getpagesize() / 1024.0 / 1024.0));
|
||||
stats_divider = "\n";
|
||||
}
|
||||
# endif
|
||||
|
||||
struct rusage ru_buffer;
|
||||
|
@ -582,7 +564,7 @@ int main(int argc, char **argv)
|
|||
}
|
||||
}
|
||||
|
||||
#if defined(YOSYS_ENABLE_COVER) && (defined(__linux__) || defined(__FreeBSD__))
|
||||
#if defined(YOSYS_ENABLE_COVER) && defined(__linux__)
|
||||
if (getenv("YOSYS_COVER_DIR") || getenv("YOSYS_COVER_FILE"))
|
||||
{
|
||||
string filename;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue