diff mbox series

[ovs-dev] ovsdb: Fix time in log traces when compacting database

Message ID 20180307180230.29693-1-dalvarez@redhat.com
State Accepted
Headers show
Series [ovs-dev] ovsdb: Fix time in log traces when compacting database | expand

Commit Message

Daniel Alvarez Sanchez March 7, 2018, 6:02 p.m. UTC
Current code is mixing wall and monotonic clocks and the traces are not
useful since the timestamps are not accurate. This patch fixes it by
using the same time reference for the log as used in the code.

Without this patch, the traces look like this:
compacting database online (1519124364.908 seconds old, 951 transactions)

Signed-off-by: Daniel Alvarez <dalvarez@redhat.com>
---
 ovsdb/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ben Pfaff March 7, 2018, 6:11 p.m. UTC | #1
On Wed, Mar 07, 2018 at 07:02:30PM +0100, Daniel Alvarez wrote:
> Current code is mixing wall and monotonic clocks and the traces are not
> useful since the timestamps are not accurate. This patch fixes it by
> using the same time reference for the log as used in the code.
> 
> Without this patch, the traces look like this:
> compacting database online (1519124364.908 seconds old, 951 transactions)
> 
> Signed-off-by: Daniel Alvarez <dalvarez@redhat.com>

Applied to master and branch-2.9, thanks!
diff mbox series

Patch

diff --git a/ovsdb/file.c b/ovsdb/file.c
index 90c2b9d20..4b7ad52ab 100644
--- a/ovsdb/file.c
+++ b/ovsdb/file.c
@@ -655,7 +655,7 @@  ovsdb_file_compact(struct ovsdb_file *file)
 
     comment = xasprintf("compacting database online "
                         "(%.3f seconds old, %u transactions)",
-                        (time_wall_msec() - file->last_compact) / 1000.0,
+                        (time_msec() - file->last_compact) / 1000.0,
                         file->n_transactions);
     VLOG_INFO("%s: %s", file->file_name, comment);