mirror of https://github.com/KLayout/klayout.git
Merge commit 'refs/pull/2003/head' of github.com:KLayout/klayout
This commit is contained in:
commit
db728dc68a
|
|
@ -33,6 +33,7 @@
|
||||||
# include <mach/mach.h>
|
# include <mach/mach.h>
|
||||||
# include <sys/times.h>
|
# include <sys/times.h>
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
|
# include <libproc.h>
|
||||||
#else
|
#else
|
||||||
# include <sys/times.h>
|
# include <sys/times.h>
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
|
|
@ -206,7 +207,18 @@ Timer::memory_size ()
|
||||||
|
|
||||||
return mem;
|
return mem;
|
||||||
|
|
||||||
#else
|
#elif defined(__APPLE__)
|
||||||
|
|
||||||
|
pid_t pid = getpid();
|
||||||
|
struct proc_taskinfo taskinfo;
|
||||||
|
if (proc_pidinfo(pid, PROC_PIDTASKINFO, 0, &taskinfo, sizeof(taskinfo)) <= 0) {
|
||||||
|
perror("proc_pidinfo failed");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return taskinfo.pti_resident_size;
|
||||||
|
|
||||||
|
#elif defined(__linux__)
|
||||||
|
|
||||||
unsigned long memsize = 0;
|
unsigned long memsize = 0;
|
||||||
FILE *procfile = fopen ("/proc/self/stat", "r");
|
FILE *procfile = fopen ("/proc/self/stat", "r");
|
||||||
|
|
@ -258,9 +270,10 @@ Timer::memory_size ()
|
||||||
memsize = 0;
|
memsize = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return size_t (memsize);
|
return size_t (memsize);
|
||||||
|
|
||||||
|
#else
|
||||||
|
# error Unsupported platform
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue