Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Y
YCSB
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Adnan Ahmad
YCSB
Commits
e80aa6e6
Commit
e80aa6e6
authored
9 years ago
by
Sean Busbey
Committed by
Robert J. Moore
9 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[client] Add estimated time remaining to status messages.
closes #239. Origin patch in PR-286.
parent
dcd885fb
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
core/src/main/java/com/yahoo/ycsb/Client.java
+49
-1
49 additions, 1 deletion
core/src/main/java/com/yahoo/ycsb/Client.java
with
49 additions
and
1 deletion
core/src/main/java/com/yahoo/ycsb/Client.java
+
49
−
1
View file @
e80aa6e6
...
...
@@ -121,16 +121,20 @@ class StatusThread extends Thread
SimpleDateFormat
format
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss:SSS"
);
long
totalops
=
0
;
long
todoops
=
0
;
// Calculate the total number of operations completed.
for
(
ClientThread
t
:
_clients
)
{
totalops
+=
t
.
getOpsDone
();
todoops
+=
t
.
getOpsTodo
();
}
long
interval
=
endIntervalMs
-
startTimeMs
;
double
throughput
=
1000.0
*(((
double
)
totalops
)/(
double
)
interval
);
double
curthroughput
=
1000.0
*(((
double
)(
totalops
-
lastTotalOps
))/((
double
)(
endIntervalMs
-
startIntervalMs
)));
long
estremaining
=
(
long
)
Math
.
ceil
(
todoops
/
throughput
);
DecimalFormat
d
=
new
DecimalFormat
(
"#.##"
);
...
...
@@ -142,6 +146,9 @@ class StatusThread extends Thread
if
(
totalops
!=
0
)
{
msg
.
append
(
d
.
format
(
curthroughput
)).
append
(
" current ops/sec; "
);
}
if
(
todoops
!=
0
)
{
msg
.
append
(
"est completion in "
).
append
(
RemainingFormatter
.
format
(
estremaining
));
}
msg
.
append
(
Measurements
.
getMeasurements
().
getSummary
());
...
...
@@ -182,6 +189,39 @@ class StatusThread extends Thread
}
}
/**
* Turn seconds remaining into more useful units.
* i.e. if there are hours or days worth of seconds, use them.
*/
class
RemainingFormatter
{
public
static
StringBuilder
format
(
long
seconds
)
{
StringBuilder
time
=
new
StringBuilder
();
long
days
=
TimeUnit
.
SECONDS
.
toDays
(
seconds
);
if
(
days
>
0
)
{
time
.
append
(
days
).
append
(
" days "
);
seconds
-=
TimeUnit
.
DAYS
.
toSeconds
(
days
);
}
long
hours
=
TimeUnit
.
SECONDS
.
toHours
(
seconds
);
if
(
hours
>
0
)
{
time
.
append
(
hours
).
append
(
" hours "
);
seconds
-=
TimeUnit
.
HOURS
.
toSeconds
(
hours
);
}
/* Only include minute granularity if we're < 1 day. */
if
(
days
<
1
)
{
long
minutes
=
TimeUnit
.
SECONDS
.
toMinutes
(
seconds
);
if
(
minutes
>
0
)
{
time
.
append
(
minutes
).
append
(
" minutes "
);
seconds
-=
TimeUnit
.
MINUTES
.
toSeconds
(
seconds
);
}
}
/* Only bother to include seconds if we're < 1 minute */
if
(
time
.
length
()
==
0
)
{
time
.
append
(
seconds
).
append
(
" seconds "
);
}
return
time
;
}
}
/**
* A thread for executing transactions or data inserts to the database.
*
...
...
@@ -356,7 +396,15 @@ class ClientThread extends Thread
_measurements
.
setIntendedStartTimeNs
(
deadline
);
}
}
/**
* the total amount of work this thread is still expected to do
*/
public
int
getOpsTodo
()
{
int
todo
=
_opcount
-
_opsdone
;
return
todo
<
0
?
0
:
todo
;
}
}
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment