mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 07:38:19 +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
|
@ -6,10 +6,23 @@
|
|||
#include "Obj.h"
|
||||
#include "IPAddr.h"
|
||||
|
||||
// Whenever subclassing the Reassembler class
|
||||
// you should add to this for known subclasses.
|
||||
enum ReassemblerType {
|
||||
REASSEM_UNKNOWN,
|
||||
REASSEM_TCP,
|
||||
REASSEM_FRAG,
|
||||
REASSEM_FILE,
|
||||
|
||||
// Terminal value. Add new above.
|
||||
REASSEM_NUM,
|
||||
};
|
||||
|
||||
class DataBlock {
|
||||
public:
|
||||
DataBlock(const u_char* data, uint64 size, uint64 seq,
|
||||
DataBlock* prev, DataBlock* next);
|
||||
DataBlock* prev, DataBlock* next,
|
||||
ReassemblerType reassem_type = REASSEM_UNKNOWN);
|
||||
|
||||
~DataBlock();
|
||||
|
||||
|
@ -19,13 +32,12 @@ public:
|
|||
DataBlock* prev; // previous block with lower seq #
|
||||
uint64 seq, upper;
|
||||
u_char* block;
|
||||
ReassemblerType rtype;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class Reassembler : public BroObj {
|
||||
public:
|
||||
Reassembler(uint64 init_seq);
|
||||
Reassembler(uint64 init_seq, ReassemblerType reassem_type = REASSEM_UNKNOWN);
|
||||
virtual ~Reassembler();
|
||||
|
||||
void NewBlock(double t, uint64 seq, uint64 len, const u_char* data);
|
||||
|
@ -51,6 +63,9 @@ public:
|
|||
// Sum over all data buffered in some reassembler.
|
||||
static uint64 TotalMemoryAllocation() { return total_size; }
|
||||
|
||||
// Data buffered by type of reassembler.
|
||||
static uint64 MemoryAllocation(ReassemblerType rtype);
|
||||
|
||||
void SetMaxOldBlocks(uint32 count) { max_old_blocks = count; }
|
||||
|
||||
protected:
|
||||
|
@ -82,12 +97,16 @@ protected:
|
|||
uint32 max_old_blocks;
|
||||
uint32 total_old_blocks;
|
||||
|
||||
ReassemblerType rtype;
|
||||
|
||||
static uint64 total_size;
|
||||
static uint64 sizes[REASSEM_NUM];
|
||||
};
|
||||
|
||||
inline DataBlock::~DataBlock()
|
||||
{
|
||||
Reassembler::total_size -= pad_size(upper - seq) + padded_sizeof(DataBlock);
|
||||
Reassembler::sizes[rtype] -= pad_size(upper - seq) + padded_sizeof(DataBlock);
|
||||
delete [] block;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue