test-coroutine: avoid overflow on 32-bit systems

unsigned long is not large enough to represent 1000000000 * duration there.
Just use floating point.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Message-id: 1417518350-6167-4-git-send-email-pbonzini@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
master
Paolo Bonzini 2014-12-02 12:05:46 +01:00 committed by Stefan Hajnoczi
parent ef57137f1b
commit 6d86ae0824
1 changed files with 1 additions and 1 deletions

View File

@ -337,7 +337,7 @@ static void perf_cost(void)
"%luns per coroutine",
maxcycles,
duration, ops,
(unsigned long)(1000000000 * duration) / maxcycles);
(unsigned long)(1000000000.0 * duration / maxcycles));
}
int main(int argc, char **argv)