-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fixed wait time for background jobs * enable multi-threaded decompiling * added preference for excluding certain packages from decompiling and indexing * show message dialog in case classes are not indexed because of low memory * added heap usage bar for visualizing Java memory usage
- Loading branch information
Showing
9 changed files
with
172 additions
and
3 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package jadx.gui.ui; | ||
|
||
import jadx.gui.utils.NLS; | ||
|
||
import javax.swing.*; | ||
import java.awt.*; | ||
import java.awt.event.ActionEvent; | ||
import java.awt.event.ActionListener; | ||
|
||
public class HeapUsageBar extends JProgressBar implements ActionListener { | ||
|
||
private static final double TWO_TO_20 = 1048576d; // 1024 * 1024 | ||
|
||
private final Color GREEN = new Color(0, 180, 0); | ||
private final Color RED = new Color(200, 0, 0); | ||
|
||
private final Runtime r; | ||
|
||
private String maxHeapStr; | ||
|
||
private final Timer timer; | ||
|
||
private final double maxGB; | ||
|
||
private final String textFormat; | ||
|
||
public HeapUsageBar() { | ||
super(); | ||
textFormat = NLS.str("heapUsage.text"); | ||
r = Runtime.getRuntime(); | ||
setBorderPainted(false); | ||
setStringPainted(true); | ||
setValue(10); | ||
int maxKB = (int) (r.maxMemory() / 1024); | ||
setMaximum(maxKB); | ||
maxGB = maxKB / TWO_TO_20; | ||
update(); | ||
timer = new Timer(1000, this); | ||
} | ||
|
||
public void update() { | ||
long used = r.totalMemory() - r.freeMemory(); | ||
int usedKB = (int) (used / 1024); | ||
setValue(usedKB); | ||
setString(String.format(textFormat, (usedKB / TWO_TO_20), maxGB)); | ||
|
||
if (used > r.totalMemory() * 0.8) { | ||
setForeground(RED); | ||
} else { | ||
setForeground(GREEN); | ||
} | ||
} | ||
|
||
@Override | ||
public void actionPerformed(ActionEvent e) { | ||
update(); | ||
} | ||
|
||
@Override | ||
public void setVisible(boolean aFlag) { | ||
super.setVisible(aFlag); | ||
if (aFlag) { | ||
timer.start(); | ||
} else { | ||
timer.stop(); | ||
} | ||
} | ||
} |
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
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