mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Merge remote-tracking branch 'origin/topic/seth/stats-improvement'
(Cleaned up some code a little bit.) * origin/topic/seth/stats-improvement: Fixing tests for stats improvements Rename the reporting interval variable for stats. Removing more broken functionality due to changed stats apis. Removing some references to resource_usage() Removing Broker stats, it was broken and incomplete. Fixing default stats collection interval to every 5 minutes. Add DNS stats to the stats.log Small stats script tweaks and beginning broker stats. Continued stats cleanup and extension. More stats collection extensions. More stats improvements Slight change to Mach API for collecting memory usage. Fixing some small mistakes. Updating the cmake submodule for the stats updates. Fix memory usage collection on Mac OS X. Cleaned up stats collection. BIT-1581 #merged
This commit is contained in:
commit
00d94f1bbc
53 changed files with 887 additions and 498 deletions
23
src/util.cc
23
src/util.cc
|
@ -14,6 +14,11 @@
|
|||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DARWIN
|
||||
#include <mach/task.h>
|
||||
#include <mach/mach_init.h>
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
@ -1611,23 +1616,35 @@ extern "C" void out_of_memory(const char* where)
|
|||
abort();
|
||||
}
|
||||
|
||||
void get_memory_usage(unsigned int* total, unsigned int* malloced)
|
||||
void get_memory_usage(uint64* total, uint64* malloced)
|
||||
{
|
||||
unsigned int ret_total;
|
||||
uint64 ret_total;
|
||||
|
||||
#ifdef HAVE_MALLINFO
|
||||
struct mallinfo mi = mallinfo();
|
||||
|
||||
if ( malloced )
|
||||
*malloced = mi.uordblks;
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DARWIN
|
||||
struct mach_task_basic_info t_info;
|
||||
mach_msg_type_number_t t_info_count = MACH_TASK_BASIC_INFO;
|
||||
|
||||
if ( KERN_SUCCESS != task_info(mach_task_self(),
|
||||
MACH_TASK_BASIC_INFO,
|
||||
(task_info_t)&t_info,
|
||||
&t_info_count) )
|
||||
ret_total = 0;
|
||||
else
|
||||
ret_total = t_info.resident_size;
|
||||
#else
|
||||
struct rusage r;
|
||||
getrusage(RUSAGE_SELF, &r);
|
||||
|
||||
// In KB.
|
||||
ret_total = r.ru_maxrss * 1024;
|
||||
#endif
|
||||
|
||||
if ( total )
|
||||
*total = ret_total;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue