projects
/
fio.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[PATCH] Add in-progress io rate
[fio.git]
/
time.c
diff --git
a/time.c
b/time.c
index c7f898be3db3a853b0328c742478c8657e41eda1..d08c791673f55b8139be5ec20cc757a891913423 100644
(file)
--- a/
time.c
+++ b/
time.c
@@
-3,6
+3,8
@@
#include "fio.h"
#include "fio.h"
+static struct timeval genesis;
+
unsigned long utime_since(struct timeval *s, struct timeval *e)
{
double sec, usec;
unsigned long utime_since(struct timeval *s, struct timeval *e)
{
double sec, usec;
@@
-97,14
+99,14
@@
void usec_sleep(struct thread_data *td, unsigned long usec)
}
void rate_throttle(struct thread_data *td, unsigned long time_spent,
}
void rate_throttle(struct thread_data *td, unsigned long time_spent,
- unsigned int bytes)
+ unsigned int bytes
, int ddir
)
{
unsigned long usec_cycle;
if (!td->rate)
return;
{
unsigned long usec_cycle;
if (!td->rate)
return;
- usec_cycle = td->rate_usec_cycle * (bytes / td->min_bs);
+ usec_cycle = td->rate_usec_cycle * (bytes / td->min_bs
[ddir]
);
if (time_spent < usec_cycle) {
unsigned long s = usec_cycle - time_spent;
if (time_spent < usec_cycle) {
unsigned long s = usec_cycle - time_spent;
@@
-120,3
+122,18
@@
void rate_throttle(struct thread_data *td, unsigned long time_spent,
td->rate_pending_usleep -= overtime;
}
}
td->rate_pending_usleep -= overtime;
}
}
+
+unsigned long mtime_since_genesis(void)
+{
+ return mtime_since_now(&genesis);
+}
+
+void time_init(void)
+{
+ gettimeofday(&genesis, NULL);
+}
+
+void fill_start_time(struct timeval *t)
+{
+ memcpy(t, &genesis, sizeof(genesis));
+}