[ 
https://issues.apache.org/jira/browse/HBASE-19450?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16294478#comment-16294478
 ] 

Reid Chan edited comment on HBASE-19450 at 12/18/17 8:50 AM:
-------------------------------------------------------------

This is a trivial patch, on purpose to provide a util to measure avg elapsed 
time for a specific method. It can be used in DEBUG or INFO, depending on 
cases. What's more, by providing elapsed time,
bq. will be more helpful to indicate potential issues.
Differences between MovingAverage are about,
# measuring last N or overall
# applying different weights to different data at different positions.

Usage is simple:
{code}
// chore() return void, so type is void.
MovingAverage<Void> timeMeasurement = new WindowMovingAverage();
...
...
timeMeasurement.measure(() -> {
  chore();
  return null;
});
LOG.info(String.format("%s average execution time: %.2f ns.", getName(), 
timeMeasurement.getAverageTime()));
{code}


was (Author: reidchan):
This is a trivial patch, on purpose to provide a util to measure avg elapsed 
time for a specific method. It can be used in DEBUG or INFO, depending on 
cases. What's more, by providing elapsed time,
bq. will be more helpful to indicate potential issues.
Differences between MovingAverage are about,
# measuring last N or overall
# applying different weights to different data at different positions.

Usage is simple:
{code}
// chore() return void, so type is void.
MovingAverage<Void> timeMeasurement = new WindowMovingAverage();
timeMeasurement.measure(() -> {
  chore();
  return null;
});
LOG.info(String.format("%s average execution time: %.2f ns.", getName(), 
timeMeasurement.getAverageTime()));
{code}

> Add log about average execution time for ScheduledChore
> -------------------------------------------------------
>
>                 Key: HBASE-19450
>                 URL: https://issues.apache.org/jira/browse/HBASE-19450
>             Project: HBase
>          Issue Type: Improvement
>            Reporter: Reid Chan
>            Assignee: Reid Chan
>            Priority: Minor
>         Attachments: HBASE-19450.master.001.patch, 
> HBASE-19450.master.002.patch, HBASE-19450.master.003.patch, 
> HBASE-19450.master.004.patch
>
>
> So far, there is no information about the exact execution time for a chore, 
> we can provide log information about it. It also brings other benefits, like 
> discovering inefficient chores which show rooms for improvement.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to