Created
January 17, 2018 15:21
-
-
Save ssmiech/9630fef58f875467dadfddd17ed0e118 to your computer and use it in GitHub Desktop.
If I ever need to figure out which threads are running when testing with Espresso
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void dumpThreads() { | |
int activeCount = Thread.activeCount(); | |
Thread[] threads = new Thread[activeCount]; | |
Thread.enumerate(threads); | |
for (Thread thread : threads) { | |
System.err.println(thread.getName() + ": " + thread.getState()); | |
for (StackTraceElement stackTraceElement : thread.getStackTrace()) { | |
System.err.println("\t" + stackTraceElement); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment