mirror of
https://gitee.com/arthas/arthas.git
synced 2024-12-02 04:08:34 +08:00
adding time cost for watching methods
This commit is contained in:
parent
d9ed410da6
commit
79714b8d38
@ -1,9 +1,9 @@
|
||||
package com.taobao.arthas.core.command.monitor200;
|
||||
|
||||
import com.taobao.arthas.core.advisor.ReflectAdviceListenerAdapter;
|
||||
import com.taobao.arthas.core.shell.command.CommandProcess;
|
||||
import com.taobao.arthas.core.advisor.Advice;
|
||||
import com.taobao.arthas.core.advisor.ArthasMethod;
|
||||
import com.taobao.arthas.core.advisor.ReflectAdviceListenerAdapter;
|
||||
import com.taobao.arthas.core.shell.command.CommandProcess;
|
||||
import com.taobao.arthas.core.util.DateUtils;
|
||||
import com.taobao.arthas.core.util.LogUtil;
|
||||
import com.taobao.arthas.core.util.StringUtils;
|
||||
@ -11,9 +11,6 @@ import com.taobao.arthas.core.util.ThreadLocalWatch;
|
||||
import com.taobao.arthas.core.view.ObjectView;
|
||||
import com.taobao.middleware.logger.Logger;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @author beiwei30 on 29/11/2016.
|
||||
*/
|
||||
@ -85,7 +82,7 @@ class WatchAdviceListener extends ReflectAdviceListenerAdapter {
|
||||
Object value = getExpressionResult(command.getExpress(), advice, cost);
|
||||
String result = StringUtils.objectToString(
|
||||
isNeedExpand() ? new ObjectView(value, command.getExpand(), command.getSizeLimit()).draw() : value);
|
||||
process.write("ts=" + DateUtils.getCurrentDate() + ";result=" + result + "\n");
|
||||
process.write("ts=" + DateUtils.getCurrentDate() + "; [cost=" + cost + "ms] result=" + result + "\n");
|
||||
process.times().incrementAndGet();
|
||||
if (isLimitExceeded(command.getNumberOfLimit(), process.times().get())) {
|
||||
abortProcess(process, command.getNumberOfLimit());
|
||||
|
Loading…
Reference in New Issue
Block a user