mirror of
https://github.com/openvswitch/ovs
synced 2025-10-17 14:28:02 +00:00
seq: Add a coverage counter for seq_change.
Having a coverage counter tracking the value of the internal seq_next should help in debugging. Suggested-by: Justin Pettit <jpettit@ovn.org> Signed-off-by: Jarno Rajahalme <jarno@ovn.org> Acked-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
@@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#include "coverage.h"
|
||||||
#include "hash.h"
|
#include "hash.h"
|
||||||
#include "hmap.h"
|
#include "hmap.h"
|
||||||
#include "latch.h"
|
#include "latch.h"
|
||||||
@@ -27,6 +28,8 @@
|
|||||||
#include "ovs-thread.h"
|
#include "ovs-thread.h"
|
||||||
#include "poll-loop.h"
|
#include "poll-loop.h"
|
||||||
|
|
||||||
|
COVERAGE_DEFINE(seq_change);
|
||||||
|
|
||||||
/* A sequence number object. */
|
/* A sequence number object. */
|
||||||
struct seq {
|
struct seq {
|
||||||
uint64_t value OVS_GUARDED;
|
uint64_t value OVS_GUARDED;
|
||||||
@@ -74,6 +77,9 @@ seq_create(void)
|
|||||||
seq_init();
|
seq_init();
|
||||||
|
|
||||||
seq = xmalloc(sizeof *seq);
|
seq = xmalloc(sizeof *seq);
|
||||||
|
|
||||||
|
COVERAGE_INC(seq_change);
|
||||||
|
|
||||||
ovs_mutex_lock(&seq_mutex);
|
ovs_mutex_lock(&seq_mutex);
|
||||||
seq->value = seq_next++;
|
seq->value = seq_next++;
|
||||||
hmap_init(&seq->waiters);
|
hmap_init(&seq->waiters);
|
||||||
@@ -100,6 +106,8 @@ void
|
|||||||
seq_change(struct seq *seq)
|
seq_change(struct seq *seq)
|
||||||
OVS_EXCLUDED(seq_mutex)
|
OVS_EXCLUDED(seq_mutex)
|
||||||
{
|
{
|
||||||
|
COVERAGE_INC(seq_change);
|
||||||
|
|
||||||
ovs_mutex_lock(&seq_mutex);
|
ovs_mutex_lock(&seq_mutex);
|
||||||
seq->value = seq_next++;
|
seq->value = seq_next++;
|
||||||
seq_wake_waiters(seq);
|
seq_wake_waiters(seq);
|
||||||
|
Reference in New Issue
Block a user