Skip to content

Commit

Permalink
adding time cost for watching methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Hearen committed Oct 13, 2018
1 parent d9ed410 commit 79714b8
Showing 1 changed file with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
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;
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.
*/
Expand Down Expand Up @@ -85,7 +82,7 @@ private void watching(Advice advice) {
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());
Expand Down

0 comments on commit 79714b8

Please sign in to comment.