Skip to content

Commit

Permalink
seq: Add a coverage counter for seq_change.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
jrajahalme committed Dec 8, 2015
1 parent 4ac0645 commit c883b4e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/seq.c
Expand Up @@ -20,13 +20,16 @@

#include <stdbool.h>

#include "coverage.h"
#include "hash.h"
#include "hmap.h"
#include "latch.h"
#include "list.h"
#include "ovs-thread.h"
#include "poll-loop.h"

COVERAGE_DEFINE(seq_change);

/* A sequence number object. */
struct seq {
uint64_t value OVS_GUARDED;
Expand Down Expand Up @@ -74,6 +77,9 @@ seq_create(void)
seq_init();

seq = xmalloc(sizeof *seq);

COVERAGE_INC(seq_change);

ovs_mutex_lock(&seq_mutex);
seq->value = seq_next++;
hmap_init(&seq->waiters);
Expand All @@ -100,6 +106,8 @@ void
seq_change(struct seq *seq)
OVS_EXCLUDED(seq_mutex)
{
COVERAGE_INC(seq_change);

ovs_mutex_lock(&seq_mutex);
seq->value = seq_next++;
seq_wake_waiters(seq);
Expand Down

0 comments on commit c883b4e

Please sign in to comment.