summaryrefslogtreecommitdiff
path: root/btt/seek.c
diff options
context:
space:
mode:
authorAlan D. Brunelle <alan.brunelle@hp.com>2008-05-21 15:55:57 -0400
committerAlan D. Brunelle <alan.brunelle@hp.com>2008-05-21 15:55:57 -0400
commit5bebfd168c3f3f42acfd4a0263e9f4d1f5faea16 (patch)
tree6c4507225f8c97170dd847e8398f9ca6cd124d05 /btt/seek.c
parentccf6d55e4875989ebb57d8a9c031d177bdc2e43a (diff)
downloadblktrace-5bebfd168c3f3f42acfd4a0263e9f4d1f5faea16.tar.gz
blktrace-5bebfd168c3f3f42acfd4a0263e9f4d1f5faea16.tar.bz2
Handled no difference in seek times
For some reason recent kernels (2.6.25.4, for example) we've lost a lot of resolution in our blktrace times. This can result in lots of things happening "simultaneously." This change at least tries to handle the case where all the seeks happen at once. Probably have other issues that need to be looked into...
Diffstat (limited to 'btt/seek.c')
-rw-r--r--btt/seek.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/btt/seek.c b/btt/seek.c
index fec57c4..69400c8 100644
--- a/btt/seek.c
+++ b/btt/seek.c
@@ -18,6 +18,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
+#include <float.h>
#include "globals.h"
static struct file_info *seek_files = NULL;
@@ -102,13 +103,13 @@ static void sps_emit(struct seeki *sip)
{
double tstamp, s_p_s;
struct sps_bkt *sps = &sip->sps;
+ double delta = sps->t_last - sps->t_start;
- if (sps->nseeks == 1) {
- s_p_s = 1.0;
+ if ((sps->nseeks == 1) || (delta < DBL_EPSILON)) {
+ s_p_s = (double)(sps->nseeks);
tstamp = sps->t_start;
}
else {
- double delta = sps->t_last - sps->t_start;
s_p_s = (double)(sps->nseeks) / delta;
tstamp = sps->t_start + (delta / 2);