|
|
|
|
@ -38,8 +38,6 @@ struct ThreadVars_;
|
|
|
|
|
*/
|
|
|
|
|
enum {
|
|
|
|
|
SC_PERF_TYPE_UINT64,
|
|
|
|
|
SC_PERF_TYPE_DOUBLE,
|
|
|
|
|
SC_PERF_TYPE_STR,
|
|
|
|
|
SC_PERF_TYPE_MAX,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
@ -48,11 +46,10 @@ enum {
|
|
|
|
|
* of the Perf counter to be registered
|
|
|
|
|
*/
|
|
|
|
|
enum {
|
|
|
|
|
SC_PERF_TYPE_Q_NORMAL = 0x01,
|
|
|
|
|
SC_PERF_TYPE_Q_AVERAGE = 0x02,
|
|
|
|
|
SC_PERF_TYPE_Q_MAXIMUM = 0x04,
|
|
|
|
|
SC_PERF_TYPE_Q_TIMEBASED = 0x08,
|
|
|
|
|
SC_PERF_TYPE_Q_MAX = 0x10,
|
|
|
|
|
SC_PERF_TYPE_Q_NORMAL = 1,
|
|
|
|
|
SC_PERF_TYPE_Q_AVERAGE = 2,
|
|
|
|
|
SC_PERF_TYPE_Q_MAXIMUM = 3,
|
|
|
|
|
SC_PERF_TYPE_Q_MAX = 4,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@ -82,48 +79,26 @@ typedef struct SCPerfCounterValue_ {
|
|
|
|
|
uint32_t type;
|
|
|
|
|
} SCPerfCounterValue;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \brief Container that holds the type qualifier for a counter
|
|
|
|
|
*/
|
|
|
|
|
typedef struct SCPerfCounterTypeQ_ {
|
|
|
|
|
int type;
|
|
|
|
|
|
|
|
|
|
int hours;
|
|
|
|
|
int minutes;
|
|
|
|
|
int seconds;
|
|
|
|
|
|
|
|
|
|
int total_secs;
|
|
|
|
|
|
|
|
|
|
/* the time interval that corresponds to the value stored for this counter.
|
|
|
|
|
* Used for time_based_counters(tbc). This represents the time period over
|
|
|
|
|
* which the value in this counter was accumulated. */
|
|
|
|
|
uint8_t tbc_secs;
|
|
|
|
|
} SCPerfCounterTypeQ;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \brief Container to hold the counter variable
|
|
|
|
|
*/
|
|
|
|
|
typedef struct SCPerfCounter_ {
|
|
|
|
|
int type;
|
|
|
|
|
|
|
|
|
|
SCPerfCounterName *name;
|
|
|
|
|
SCPerfCounterValue *value;
|
|
|
|
|
|
|
|
|
|
/* local id for this counter in this tm */
|
|
|
|
|
uint16_t id;
|
|
|
|
|
|
|
|
|
|
/* description of this counter */
|
|
|
|
|
char *desc;
|
|
|
|
|
|
|
|
|
|
/* no of times the local counter has been synced with this counter */
|
|
|
|
|
uint64_t updated;
|
|
|
|
|
|
|
|
|
|
/* flag that indicates if this counter should be displayed or not */
|
|
|
|
|
int disp;
|
|
|
|
|
|
|
|
|
|
/* counter qualifier */
|
|
|
|
|
SCPerfCounterTypeQ *type_q;
|
|
|
|
|
|
|
|
|
|
/* the next perfcounter for this tv's tm instance */
|
|
|
|
|
struct SCPerfCounter_ *next;
|
|
|
|
|
|
|
|
|
|
/* description of this counter */
|
|
|
|
|
char *desc;
|
|
|
|
|
} SCPerfCounter;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@ -153,20 +128,10 @@ typedef struct SCPCAElem_ {
|
|
|
|
|
/* counter id of the above counter(pc) */
|
|
|
|
|
uint16_t id;
|
|
|
|
|
|
|
|
|
|
union {
|
|
|
|
|
uint64_t ui64_cnt;
|
|
|
|
|
double d_cnt;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* no of times the local counter has been updated */
|
|
|
|
|
uint64_t syncs;
|
|
|
|
|
|
|
|
|
|
/* indicates the times syncs has overflowed */
|
|
|
|
|
uint64_t wrapped_syncs;
|
|
|
|
|
|
|
|
|
|
/* timestamp to indicate the time, when the counter was last used to update
|
|
|
|
|
* the global counter. It is used for timebased counter calculations */
|
|
|
|
|
struct timeval ts;
|
|
|
|
|
} SCPCAElem;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
@ -223,21 +188,16 @@ void SCPerfSpawnThreads(void);
|
|
|
|
|
uint16_t SCPerfTVRegisterCounter(char *, struct ThreadVars_ *, int, char *);
|
|
|
|
|
uint16_t SCPerfTVRegisterAvgCounter(char *, struct ThreadVars_ *, int, char *);
|
|
|
|
|
uint16_t SCPerfTVRegisterMaxCounter(char *, struct ThreadVars_ *, int, char *);
|
|
|
|
|
uint16_t SCPerfTVRegisterIntervalCounter(char *, struct ThreadVars_ *, int,
|
|
|
|
|
char *, char *);
|
|
|
|
|
|
|
|
|
|
/* the non-ThreadVars counter registration functions */
|
|
|
|
|
uint16_t SCPerfRegisterCounter(char *, char *, int, char *, SCPerfContext *);
|
|
|
|
|
uint16_t SCPerfRegisterAvgCounter(char *, char *, int, char *, SCPerfContext *);
|
|
|
|
|
uint16_t SCPerfRegisterMaxCounter(char *, char *, int, char *, SCPerfContext *);
|
|
|
|
|
uint16_t SCPerfRegisterIntervalCounter(char *, char *, int, char *,
|
|
|
|
|
SCPerfContext *, char *);
|
|
|
|
|
|
|
|
|
|
/* utility functions */
|
|
|
|
|
int SCPerfAddToClubbedTMTable(char *, SCPerfContext *);
|
|
|
|
|
SCPerfCounterArray *SCPerfGetCounterArrayRange(uint16_t, uint16_t, SCPerfContext *);
|
|
|
|
|
SCPerfCounterArray * SCPerfGetAllCountersArray(SCPerfContext *);
|
|
|
|
|
int SCPerfCounterDisplay(uint16_t, SCPerfContext *, int);
|
|
|
|
|
|
|
|
|
|
int SCPerfUpdateCounterArray(SCPerfCounterArray *, SCPerfContext *, int);
|
|
|
|
|
double SCPerfGetLocalCounterValue(uint16_t, SCPerfCounterArray *);
|
|
|
|
|
@ -250,14 +210,12 @@ void SCPerfReleasePerfCounterS(SCPerfCounter *);
|
|
|
|
|
void SCPerfReleasePCA(SCPerfCounterArray *);
|
|
|
|
|
|
|
|
|
|
void SCPerfCounterSetUI64(uint16_t, SCPerfCounterArray *, uint64_t);
|
|
|
|
|
void SCPerfCounterSetDouble(uint16_t, SCPerfCounterArray *, double);
|
|
|
|
|
void SCPerfCounterIncr(uint16_t, SCPerfCounterArray *);
|
|
|
|
|
|
|
|
|
|
void SCPerfRegisterTests(void);
|
|
|
|
|
|
|
|
|
|
/* functions used to update local counter values */
|
|
|
|
|
void SCPerfCounterAddUI64(uint16_t, SCPerfCounterArray *, uint64_t);
|
|
|
|
|
void SCPerfCounterAddDouble(uint16_t, SCPerfCounterArray *, double);
|
|
|
|
|
|
|
|
|
|
#define SCPerfSyncCounters(tv, reset_lc) \
|
|
|
|
|
SCPerfUpdateCounterArray((tv)->sc_perf_pca, &(tv)->sc_perf_pctx, (reset_lc)); \
|
|
|
|
|
|