-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Record job start time obtained via clock_gettime to fix time pain points #1617
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4103,22 +4103,24 @@ Measurements and reporting | |
|
||
.. option:: log_unix_epoch=bool | ||
|
||
If set, fio will log Unix timestamps to the log files produced by enabling | ||
write_type_log for each log type, instead of the default zero-based | ||
timestamps. | ||
Backwards compatible alias for log_alternate_epoch. | ||
|
||
.. option:: log_alternate_epoch=bool | ||
|
||
If set, fio will log timestamps based on the epoch used by the clock specified | ||
in the log_alternate_epoch_clock_id option, to the log files produced by | ||
enabling write_type_log for each log type, instead of the default zero-based | ||
timestamps. | ||
If set, fio will log timestamps based on the epoch used by the clock | ||
specified in the clock_id option, to the log files produced by enabling | ||
write_type_log for each log type, instead of the default zero-based | ||
timestamps. | ||
|
||
.. option:: log_alternate_epoch_clock_id=int | ||
|
||
Specifies the clock_id to be used by clock_gettime to obtain the alternate epoch | ||
if either log_unix_epoch or log_alternate_epoch are true. Otherwise has no | ||
effect. Default value is 0, or CLOCK_REALTIME. | ||
Backwards compatible alias for clock_id. | ||
|
||
.. option:: clock_id=int | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The name There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Gotcha. It used to be How about There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would it be cleaner to just create a brand new option and There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm happy to do that (completely separate option and Before I started using fio, there was a Then I added Anyways, that's why job start time ends up so "tied" to the options for log file timestamps. But there is no reason the log file timestamps and the recorded job start time have to share the same clock_id. If I had a time machine, I'd stop any of the But I know that can't happen. Maybe all of this is really just another good argument for what you suggested, as it keeps the (imho) log timestamps and recording job start time completely separate in terms of implementation, so either one could be revamped in the future without having to worry about the other. Just let me know what you think is best (just make it two separate things or try to come up with an option name for both purposes); I'm happy to do it either way. Thanks for listening to my rambling thoughts. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the recap. I think it would be cleaner to just have an entirely separate start time feature. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cool, I'll do that then. Thanks for the feedback! |
||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's a redundant mention of clock_gettime in the first sentence below. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oops, thanks, I'll fix that. |
||
Specifies the clock_id to be used by clock_gettime to obtain the start time | ||
of a job via clock_gettime. Default value is 0, or CLOCK_REALTIME, which | ||
yields times based on the unix epoch. | ||
|
||
.. option:: block_error_percentiles=bool | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1712,6 +1712,7 @@ static struct json_object *show_thread_status_json(struct thread_stat *ts, | |
root = json_create_object(); | ||
json_object_add_value_string(root, "jobname", ts->name); | ||
json_object_add_value_int(root, "groupid", ts->groupid); | ||
json_object_add_value_int(root, "clock_gettime_job_start", ts->clock_gettime_job_start); | ||
json_object_add_value_int(root, "error", ts->error); | ||
|
||
/* ETA Info */ | ||
|
@@ -2526,6 +2527,7 @@ void __show_run_stats(void) | |
*/ | ||
ts->thread_number = td->thread_number; | ||
ts->groupid = td->groupid; | ||
ts->clock_gettime_job_start = td->clock_gettime_job_start; | ||
|
||
/* | ||
* first pid in group, not very useful... | ||
|
@@ -3044,11 +3046,13 @@ static void __add_log_sample(struct io_log *iolog, union io_sample_data data, | |
cur_log = get_cur_log(iolog); | ||
if (cur_log) { | ||
struct io_sample *s; | ||
bool add_alternate_epoch; | ||
|
||
s = get_sample(iolog, cur_log, cur_log->nr_samples); | ||
|
||
s->data = data; | ||
s->time = t + (iolog->td ? iolog->td->alternate_epoch : 0); | ||
add_alternate_epoch = (iolog->td != NULL) && iolog->td->o.log_alternate_epoch; | ||
s->time = t + (add_alternate_epoch ? iolog->td->clock_gettime_job_start : 0); | ||
io_sample_set_ddir(iolog, s, ddir); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the following would be easier for a human to read:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks, agreed. I had pulled the boolean out when the test had gotten more complicated but it ended up pretty short. I'll update. |
||
s->bs = bs; | ||
s->priority = priority; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was accidentally included.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, will remove