Skip to content

Commit

Permalink
vjtop过滤线程名时忽略大小写 vipshop#111
Browse files Browse the repository at this point in the history
  • Loading branch information
calvin1978 committed Aug 30, 2018
1 parent 9eacb86 commit 14ccca2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
11 changes: 4 additions & 7 deletions vjtop/src/main/java/com/vip/vjtools/vjtop/InteractiveTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -207,14 +207,11 @@ private void changeThreadFilter() {
if (threadNameFilter != null && threadNameFilter.trim().length() == 0) {
threadNameFilter = null;
}
if (threadNameFilter != app.view.threadNameFilter) {
app.view.threadNameFilter = threadNameFilter;
tty.println(" thread name filter change to " + threadNameFilter + " for next flush (" + app.nextFlushTime()
+ "s later)");

} else {
tty.println(" Nothing be changed");
}
app.view.threadNameFilter = threadNameFilter != null ? threadNameFilter.toLowerCase() : null;
tty.println(" thread name filter change to " + threadNameFilter + " for next flush (" + app.nextFlushTime()
+ "s later)");


app.continueFlush();
}
Expand Down
6 changes: 3 additions & 3 deletions vjtop/src/main/java/com/vip/vjtools/vjtop/VMDetailView.java
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ private void printTopCpuThreads(DetailMode mode) throws IOException {
Long tid = info.getThreadId();
String threadName = Formats.shortName(info.getThreadName(), getThreadNameWidth(), 20);
// 过滤threadName
if (threadNameFilter != null && !threadName.contains(threadNameFilter)) {
if (threadNameFilter != null && !threadName.toLowerCase().contains(threadNameFilter)) {
continue;
}
// 刷新间隔里,所使用的单核CPU比例
Expand Down Expand Up @@ -406,7 +406,7 @@ private void printTopMemoryThreads(DetailMode mode) throws IOException {
String threadName = Formats.shortName(info.getThreadName(), getThreadNameWidth(), 12);

// 过滤threadName
if (threadNameFilter != null && !threadName.contains(threadNameFilter)) {
if (threadNameFilter != null && !threadName.toLowerCase().contains(threadNameFilter)) {
continue;
}

Expand Down Expand Up @@ -522,7 +522,7 @@ public void printAllThreads() throws IOException {
}

String threadName = info.getThreadName();
if (threadNameFilter != null && !threadName.contains(threadNameFilter)) {
if (threadNameFilter != null && !threadName.toLowerCase().contains(threadNameFilter)) {
continue;
}
System.out.println(
Expand Down

0 comments on commit 14ccca2

Please sign in to comment.