Skip to content
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

Polishing #2663 #2672

Merged
merged 1 commit into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,7 @@
import com.taobao.arthas.core.command.Constants;
import com.taobao.arthas.core.command.express.ExpressException;
import com.taobao.arthas.core.command.express.ExpressFactory;
import com.taobao.arthas.core.command.model.MessageModel;
import com.taobao.arthas.core.command.model.ObjectVO;
import com.taobao.arthas.core.command.model.RowAffectModel;
import com.taobao.arthas.core.command.model.TimeFragmentVO;
import com.taobao.arthas.core.command.model.TimeTunnelModel;
import com.taobao.arthas.core.command.model.*;
import com.taobao.arthas.core.shell.command.CommandProcess;
import com.taobao.arthas.core.shell.handlers.command.CommandInterruptHandler;
import com.taobao.arthas.core.shell.handlers.shell.QExitHandler;
Expand All @@ -22,15 +18,10 @@
import com.taobao.arthas.core.util.StringUtils;
import com.taobao.arthas.core.util.affect.RowAffect;
import com.taobao.arthas.core.util.matcher.Matcher;
import com.taobao.middleware.cli.annotations.Description;
import com.taobao.middleware.cli.annotations.Name;
import com.taobao.middleware.cli.annotations.Option;
import com.taobao.middleware.cli.annotations.Summary;
import com.taobao.middleware.cli.annotations.Argument;
import com.taobao.middleware.cli.annotations.*;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Date;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
import java.io.PrintWriter;
import java.io.StringWriter;
import java.lang.reflect.InvocationTargetException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

Expand Down Expand Up @@ -93,9 +92,8 @@ static TableElement fillTableRow(TableElement table, TimeFragmentVO tf) {
}

public static void drawTimeTunnel(TableElement table, TimeFragmentVO tf) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
table.row("INDEX", "" + tf.getIndex())
.row("GMT-CREATE", sdf.format(tf.getTimestamp()))
.row("GMT-CREATE", DateUtils.formatDateTime(tf.getTimestamp()))
.row("COST(ms)", "" + tf.getCost())
.row("OBJECT", tf.getObject())
.row("CLASS", tf.getClassName())
Expand Down Expand Up @@ -161,9 +159,8 @@ public static void drawWatchResults(TableElement table, Map<Integer, ObjectVO> w

public static TableElement drawPlayHeader(String className, String methodName, String objectAddress, int index,
TableElement table) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return table.row("RE-INDEX", "" + index)
.row("GMT-REPLAY", sdf.format(new Date()))
.row("GMT-REPLAY", DateUtils.formatDateTime(LocalDateTime.now()))
.row("OBJECT", objectAddress)
.row("CLASS", className)
.row("METHOD", methodName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import com.taobao.text.util.RenderUtil;

import java.text.DecimalFormat;
import java.text.SimpleDateFormat;

import static com.taobao.text.ui.Element.label;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ private DateUtils() {
throw new AssertionError();
}

public static DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS");
private static final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS");

public static String getCurrentDateTime() {
return DATE_TIME_FORMATTER.format(LocalDateTime.now());
Expand Down