|
suricata
|
#include "threads.h"

Go to the source code of this file.
Data Structures | |
| struct | StatsCounterId |
| struct | StatsCounterAvgId |
| struct | StatsCounterMaxId |
| struct | StatsCounterGlobalId |
| struct | StatsCounterDeriveId |
| struct | StatsCounter_ |
| Container to hold the counter variable. More... | |
| struct | StatsLocalCounter_ |
| counter type for local (private) increments. For AVG counters we use 2 to track values and updates. More... | |
| struct | StatsPublicThreadContext_ |
| Stats Context for a ThreadVars instance. More... | |
| struct | StatsPrivateThreadContext_ |
| used to hold the private version of the counters registered More... | |
| struct | StatsThreadContext_ |
Typedefs | |
| typedef struct StatsCounterId | StatsCounterId |
| typedef struct StatsCounterAvgId | StatsCounterAvgId |
| typedef struct StatsCounterMaxId | StatsCounterMaxId |
| typedef struct StatsCounterGlobalId | StatsCounterGlobalId |
| typedef struct StatsCounterDeriveId | StatsCounterDeriveId |
| typedef struct StatsCounter_ | StatsCounter |
| Container to hold the counter variable. More... | |
| typedef struct StatsLocalCounter_ | StatsLocalCounter |
| counter type for local (private) increments. For AVG counters we use 2 to track values and updates. More... | |
| typedef struct StatsPublicThreadContext_ | StatsPublicThreadContext |
| Stats Context for a ThreadVars instance. More... | |
| typedef struct StatsPrivateThreadContext_ | StatsPrivateThreadContext |
| used to hold the private version of the counters registered More... | |
| typedef struct StatsThreadContext_ | StatsThreadContext |
Functions | |
| void | StatsInit (void) |
| Initializes the perf counter api. Things are hard coded currently. More work to be done when we implement multiple interfaces. More... | |
| void | StatsSetupPostConfigPreOutput (void) |
| void | StatsSetupPostConfigPostOutput (void) |
| void | StatsSpawnThreads (void) |
| Spawns the wakeup, and the management thread used by the stats api. More... | |
| void | StatsRegisterTests (void) |
| bool | StatsEnabled (void) |
| void | StatsReleaseResources (void) |
| Releases the resources allotted by the Stats API. More... | |
| StatsCounterId | StatsRegisterCounter (const char *, StatsThreadContext *) |
| Registers a normal, unqualified counter. More... | |
| StatsCounterAvgId | StatsRegisterAvgCounter (const char *, StatsThreadContext *) |
| Registers a counter, whose value holds the average of all the values assigned to it. More... | |
| StatsCounterMaxId | StatsRegisterMaxCounter (const char *, StatsThreadContext *) |
| Registers a counter, whose value holds the maximum of all the values assigned to it. More... | |
| StatsCounterGlobalId | StatsRegisterGlobalCounter (const char *cname, uint64_t(*Func)(void)) |
| Registers a counter, which represents a global value. More... | |
| StatsCounterDeriveId | StatsRegisterDeriveDivCounter (const char *cname, const char *dname1, const char *dname2, StatsThreadContext *) |
| Registers a counter which tracks the result of the calculating the value of counter dname1 divided by the value of the counter dname2. More... | |
| void | StatsCounterAddI64 (StatsThreadContext *, StatsCounterId, int64_t) |
| Adds a value of type uint64_t to the local counter. More... | |
| void | StatsCounterSetI64 (StatsThreadContext *, StatsCounterId, int64_t) |
| set, so overwrite, the value of the local counter More... | |
| void | StatsCounterIncr (StatsThreadContext *, StatsCounterId) |
| Increments the local counter. More... | |
| void | StatsCounterDecr (StatsThreadContext *, StatsCounterId) |
| Decrements the local counter. More... | |
| void | StatsCounterMaxUpdateI64 (StatsThreadContext *, StatsCounterMaxId id, int64_t x) |
| update the value of the localmax counter More... | |
| void | StatsCounterAvgAddI64 (StatsThreadContext *, StatsCounterAvgId id, int64_t x) |
| int64_t | StatsCounterGetLocalValue (StatsThreadContext *, StatsCounterId) |
| Get the value of the local copy of the counter that hold this id. More... | |
| void | StatsThreadInit (StatsThreadContext *) |
| int | StatsSetupPrivate (StatsThreadContext *, const char *) |
| void | StatsThreadCleanup (StatsThreadContext *) |
| void | StatsSyncCounters (StatsThreadContext *) |
| void | StatsSyncCountersIfSignalled (StatsThreadContext *) |
Definition in file counters.h.
| typedef struct StatsCounter_ StatsCounter |
Container to hold the counter variable.
| typedef struct StatsCounterAvgId StatsCounterAvgId |
| typedef struct StatsCounterDeriveId StatsCounterDeriveId |
| typedef struct StatsCounterGlobalId StatsCounterGlobalId |
| typedef struct StatsCounterId StatsCounterId |
| typedef struct StatsCounterMaxId StatsCounterMaxId |
| typedef struct StatsLocalCounter_ StatsLocalCounter |
counter type for local (private) increments. For AVG counters we use 2 to track values and updates.
| typedef struct StatsPrivateThreadContext_ StatsPrivateThreadContext |
used to hold the private version of the counters registered
| typedef struct StatsPublicThreadContext_ StatsPublicThreadContext |
Stats Context for a ThreadVars instance.
| typedef struct StatsThreadContext_ StatsThreadContext |
| void StatsCounterAddI64 | ( | StatsThreadContext * | stats, |
| StatsCounterId | id, | ||
| int64_t | x | ||
| ) |
Adds a value of type uint64_t to the local counter.
| id | ID of the counter as set by the API |
| pca | Counter array that holds the local counter for this TM |
| x | Value to add to this local counter |
Definition at line 147 of file counters.c.
References BUG_ON, StatsPrivateThreadContext_::head, StatsPrivateThreadContext_::initialized, StatsThreadContext_::priv, StatsPrivateThreadContext_::size, and StatsLocalCounter_::v.
Referenced by AppLayerIncTxCounter(), and DecodeUpdatePacketCounters().

| void StatsCounterAvgAddI64 | ( | StatsThreadContext * | , |
| StatsCounterAvgId | id, | ||
| int64_t | x | ||
| ) |
Definition at line 241 of file counters.c.
References BUG_ON, StatsPrivateThreadContext_::head, StatsPrivateThreadContext_::initialized, StatsThreadContext_::priv, StatsPrivateThreadContext_::size, and StatsLocalCounter_::v.
| void StatsCounterDecr | ( | StatsThreadContext * | stats, |
| StatsCounterId | id | ||
| ) |
Decrements the local counter.
| stats | per thread counter structure |
| id | Index of the counter in the counter array |
Definition at line 185 of file counters.c.
References BUG_ON, StatsPrivateThreadContext_::head, StatsPrivateThreadContext_::initialized, StatsThreadContext_::priv, StatsPrivateThreadContext_::size, and StatsLocalCounter_::v.
| int64_t StatsCounterGetLocalValue | ( | StatsThreadContext * | stats, |
| StatsCounterId | id | ||
| ) |
Get the value of the local copy of the counter that hold this id.
| tv | threadvars |
| id | The counter id. |
| 0 | on success. |
| -1 | on error. |
Definition at line 1376 of file counters.c.
References BUG_ON, StatsPrivateThreadContext_::head, StatsThreadContext_::priv, StatsPrivateThreadContext_::size, and StatsLocalCounter_::v.
Referenced by ReceiveErfDagThreadExitStats().

| void StatsCounterIncr | ( | StatsThreadContext * | stats, |
| StatsCounterId | id | ||
| ) |
Increments the local counter.
| id | Index of the counter in the counter array |
| pca | Counter array that holds the local counters for this TM |
Definition at line 166 of file counters.c.
References BUG_ON, StatsPrivateThreadContext_::head, StatsPrivateThreadContext_::initialized, StatsThreadContext_::priv, StatsPrivateThreadContext_::size, and StatsLocalCounter_::v.
Referenced by AppLayerIncAllocErrorCounter(), AppLayerIncGapErrorCounter(), AppLayerIncInternalErrorCounter(), AppLayerIncParserErrorCounter(), CaptureStatsUpdate(), DecodeARP(), DecodeCHDLC(), DecodeERSPAN(), DecodeERSPANTypeI(), DecodeESP(), DecodeETag(), DecodeEthernet(), DecodeGRE(), DecodeICMPV4(), DecodeIPV4(), DecodeIPV6(), DecodeMPLS(), DecodeNSH(), DecodeNull(), DecodePPP(), DecodePPPOEDiscovery(), DecodePPPOESession(), DecodeRaw(), DecodeSCTP(), DecodeSll(), DecodeSll2(), DecodeTCP(), DecodeUDP(), DecodeUpdatePacketCounters(), DecodeVLAN(), DecodeVNTag(), PacketDecodeFinalize(), PacketUpdateEngineEventCounters(), and StreamTcpGetSegment().

| void StatsCounterMaxUpdateI64 | ( | StatsThreadContext * | stats, |
| StatsCounterMaxId | id, | ||
| int64_t | x | ||
| ) |
update the value of the localmax counter
| stats | per thread counter structure |
| id | Index of the local counter in the counter array |
| x | The value to set for the counter |
Definition at line 225 of file counters.c.
References BUG_ON, StatsPrivateThreadContext_::head, StatsPrivateThreadContext_::initialized, StatsThreadContext_::priv, StatsPrivateThreadContext_::size, and StatsLocalCounter_::v.
Referenced by DecodeUpdatePacketCounters().

| void StatsCounterSetI64 | ( | StatsThreadContext * | stats, |
| StatsCounterId | id, | ||
| int64_t | x | ||
| ) |
set, so overwrite, the value of the local counter
| stats | per thread counter structure |
| id | Index of the local counter in the counter array |
| x | The value to set for the counter |
Definition at line 205 of file counters.c.
References BUG_ON, StatsPrivateThreadContext_::head, StatsPrivateThreadContext_::initialized, StatsThreadContext_::priv, StatsPrivateThreadContext_::size, and StatsLocalCounter_::v.
| bool StatsEnabled | ( | void | ) |
Definition at line 117 of file counters.c.
| void StatsInit | ( | void | ) |
Initializes the perf counter api. Things are hard coded currently. More work to be done when we implement multiple interfaces.
Definition at line 963 of file counters.c.
References BUG_ON.
Referenced by PreRunInit().

| StatsCounterAvgId StatsRegisterAvgCounter | ( | const char * | name, |
| StatsThreadContext * | stats | ||
| ) |
Registers a counter, whose value holds the average of all the values assigned to it.
| name | Name of the counter, to be registered |
| tv | Pointer to the ThreadVars instance for which the counter would be registered |
| id | Counter id for the newly registered counter, or the already present counter |
Definition at line 1058 of file counters.c.
| StatsCounterId StatsRegisterCounter | ( | const char * | name, |
| StatsThreadContext * | stats | ||
| ) |
Registers a normal, unqualified counter.
| name | Name of the counter, to be registered |
| tv | Pointer to the ThreadVars instance for which the counter would be registered |
| id | Counter id for the newly registered counter, or the already present counter |
Definition at line 1039 of file counters.c.
Referenced by CaptureStatsSetup(), DecodeRegisterPerfCounters(), ExceptionPolicySetStatsCounters(), FlowEndCountersRegister(), ReceiveErfDagThreadInit(), and StreamTcpThreadInit().

| StatsCounterDeriveId StatsRegisterDeriveDivCounter | ( | const char * | name, |
| const char * | dname1, | ||
| const char * | dname2, | ||
| StatsThreadContext * | stats | ||
| ) |
Registers a counter which tracks the result of the calculating the value of counter dname1 divided by the value of the counter dname2.
| name | Name of the counter, to be registered |
| dname1 | First counter name |
| dname2 | Second counter name |
Both counters need to already be registered in this thread.
| id | Counter id for the newly registered counter, or the already present counter |
Definition at line 1122 of file counters.c.
References StatsCounterDeriveId::id.
Referenced by DecodeRegisterPerfCounters().

| StatsCounterGlobalId StatsRegisterGlobalCounter | ( | const char * | name, |
| uint64_t(*)(void) | Func | ||
| ) |
Registers a counter, which represents a global value.
| name | Name of the counter, to be registered |
| Func | Function Pointer returning a uint64_t |
| id | Counter id for the newly registered counter, or the already present counter |
Definition at line 1094 of file counters.c.
References StatsCounterGlobalId::id.
Referenced by AppLayerRegisterGlobalCounters(), OutputFilestoreRegisterGlobalCounters(), and ThresholdRegisterGlobalCounters().

| StatsCounterMaxId StatsRegisterMaxCounter | ( | const char * | name, |
| StatsThreadContext * | stats | ||
| ) |
Registers a counter, whose value holds the maximum of all the values assigned to it.
| name | Name of the counter, to be registered |
| tv | Pointer to the ThreadVars instance for which the counter would be registered |
| the | counter id for the newly registered counter, or the already present counter |
Definition at line 1077 of file counters.c.
Referenced by DecodeRegisterPerfCounters().

| void StatsRegisterTests | ( | void | ) |
Definition at line 1653 of file counters.c.
References UtRegisterTest().

| void StatsReleaseResources | ( | void | ) |
Releases the resources allotted by the Stats API.
Definition at line 1388 of file counters.c.
| void StatsSetupPostConfigPostOutput | ( | void | ) |
Definition at line 978 of file counters.c.
Referenced by PreRunPostPrivsDropInit().

| void StatsSetupPostConfigPreOutput | ( | void | ) |
Definition at line 973 of file counters.c.
Referenced by PreRunPostPrivsDropInit().

| int StatsSetupPrivate | ( | StatsThreadContext * | , |
| const char * | |||
| ) |
Definition at line 1313 of file counters.c.
| void StatsSpawnThreads | ( | void | ) |
Spawns the wakeup, and the management thread used by the stats api.
The threads use the condition variable in the thread vars to control their wait loops to make sure the main thread can quickly kill them.
Definition at line 990 of file counters.c.
References SCEnter.
| void StatsSyncCounters | ( | StatsThreadContext * | ) |
Definition at line 479 of file counters.c.
Referenced by SCTmThreadsSlotPacketLoopFinish().

| void StatsSyncCountersIfSignalled | ( | StatsThreadContext * | ) |
Definition at line 484 of file counters.c.
References StatsThreadContext_::pub, and SC_ATOMIC_GET.
Referenced by TmqhInputFlow(), and TmqhInputSimple().

| void StatsThreadCleanup | ( | StatsThreadContext * | ) |
Definition at line 1429 of file counters.c.
Referenced by UTHMatchPackets(), UTHMatchPacketsWithResults(), UTHPacketMatchSig(), and UTHPacketMatchSigMpm().

| void StatsThreadInit | ( | StatsThreadContext * | ) |
Definition at line 1333 of file counters.c.
Referenced by TmThreadCreate(), UTHMatchPackets(), UTHMatchPacketsWithResults(), UTHPacketMatchSig(), and UTHPacketMatchSigMpm().
