mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 02:39:44 +02:00
GP-0: Adding some timing messages
This commit is contained in:
parent
d04b285f8d
commit
27985d755b
4 changed files with 20 additions and 7 deletions
|
@ -27,12 +27,10 @@ import ghidra.base.help.GhidraHelpService;
|
||||||
import ghidra.framework.Application;
|
import ghidra.framework.Application;
|
||||||
import ghidra.framework.GhidraApplicationConfiguration;
|
import ghidra.framework.GhidraApplicationConfiguration;
|
||||||
import ghidra.framework.client.RepositoryAdapter;
|
import ghidra.framework.client.RepositoryAdapter;
|
||||||
import ghidra.framework.data.DomainObjectAdapter;
|
|
||||||
import ghidra.framework.main.FrontEndTool;
|
import ghidra.framework.main.FrontEndTool;
|
||||||
import ghidra.framework.model.*;
|
import ghidra.framework.model.*;
|
||||||
import ghidra.framework.project.DefaultProjectManager;
|
import ghidra.framework.project.DefaultProjectManager;
|
||||||
import ghidra.framework.store.LockException;
|
import ghidra.framework.store.LockException;
|
||||||
import ghidra.program.database.ProgramDB;
|
|
||||||
import ghidra.util.*;
|
import ghidra.util.*;
|
||||||
import ghidra.util.exception.UsrException;
|
import ghidra.util.exception.UsrException;
|
||||||
import ghidra.util.extensions.ExtensionUtils;
|
import ghidra.util.extensions.ExtensionUtils;
|
||||||
|
@ -90,6 +88,9 @@ public class GhidraRun implements GhidraLaunchable {
|
||||||
SystemUtilities.runSwingLater(() -> {
|
SystemUtilities.runSwingLater(() -> {
|
||||||
String projectPath = processArguments(args);
|
String projectPath = processArguments(args);
|
||||||
openProject(projectPath);
|
openProject(projectPath);
|
||||||
|
|
||||||
|
log.info("Ghidra starup complete (" + GhidraLauncher.getMillisecondsFromLaunch() +
|
||||||
|
" ms)");
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,7 @@ import java.net.URL;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import generic.stl.Pair;
|
import generic.stl.Pair;
|
||||||
import ghidra.GhidraApplicationLayout;
|
import ghidra.*;
|
||||||
import ghidra.GhidraLaunchable;
|
|
||||||
import ghidra.app.util.opinion.Loader;
|
import ghidra.app.util.opinion.Loader;
|
||||||
import ghidra.framework.*;
|
import ghidra.framework.*;
|
||||||
import ghidra.framework.model.DomainFolder;
|
import ghidra.framework.model.DomainFolder;
|
||||||
|
@ -118,6 +117,9 @@ public class AnalyzeHeadless implements GhidraLaunchable {
|
||||||
HeadlessOptions options = analyzer.getOptions();
|
HeadlessOptions options = analyzer.getOptions();
|
||||||
parseOptions(options, args, optionStartIndex, ghidraURL, filesToImport);
|
parseOptions(options, args, optionStartIndex, ghidraURL, filesToImport);
|
||||||
|
|
||||||
|
Msg.info(AnalyzeHeadless.class,
|
||||||
|
"Headless startup complete (" + GhidraLauncher.getMillisecondsFromLaunch() + " ms)");
|
||||||
|
|
||||||
// Do the headless processing
|
// Do the headless processing
|
||||||
try {
|
try {
|
||||||
if (ghidraURL != null) {
|
if (ghidraURL != null) {
|
||||||
|
|
|
@ -273,8 +273,8 @@ public class ClassSearcher {
|
||||||
|
|
||||||
SystemUtilities.runSwingNow(() -> fireClassListChanged());
|
SystemUtilities.runSwingNow(() -> fireClassListChanged());
|
||||||
|
|
||||||
t = (new Date()).getTime() - t;
|
String finishedMessage = "Class search complete (%d ms, %d classes loaded)"
|
||||||
String finishedMessage = "Class search complete (" + t + " ms)";
|
.formatted((new Date()).getTime() - t, extensionPoints.size());
|
||||||
monitor.setMessage(finishedMessage);
|
monitor.setMessage(finishedMessage);
|
||||||
log.info(finishedMessage);
|
log.info(finishedMessage);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,8 @@ package ghidra;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
|
import java.time.Instant;
|
||||||
|
import java.time.temporal.ChronoUnit;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@ -35,6 +37,8 @@ import utility.module.ModuleUtilities;
|
||||||
*/
|
*/
|
||||||
public class GhidraLauncher {
|
public class GhidraLauncher {
|
||||||
|
|
||||||
|
private static Instant START_INSTANT = Instant.now();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Launches the given {@link GhidraLaunchable} specified in the first command line argument
|
* Launches the given {@link GhidraLaunchable} specified in the first command line argument
|
||||||
*
|
*
|
||||||
|
@ -46,7 +50,6 @@ public class GhidraLauncher {
|
||||||
*/
|
*/
|
||||||
public static void launch(String[] args) throws Exception {
|
public static void launch(String[] args) throws Exception {
|
||||||
|
|
||||||
// Initialize the Ghidra environment
|
|
||||||
GhidraApplicationLayout layout = initializeGhidraEnvironment();
|
GhidraApplicationLayout layout = initializeGhidraEnvironment();
|
||||||
|
|
||||||
// Make sure the thing to launch meets the criteria:
|
// Make sure the thing to launch meets the criteria:
|
||||||
|
@ -93,6 +96,13 @@ public class GhidraLauncher {
|
||||||
launch(args);
|
launch(args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@return the current number of milliseconds that have elapsed since execution began}
|
||||||
|
*/
|
||||||
|
public static long getMillisecondsFromLaunch() {
|
||||||
|
return ChronoUnit.MILLIS.between(START_INSTANT, Instant.now());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes the Ghidra environment by discovering its {@link GhidraApplicationLayout layout}
|
* Initializes the Ghidra environment by discovering its {@link GhidraApplicationLayout layout}
|
||||||
* and adding all relevant modules and libraries to the classpath
|
* and adding all relevant modules and libraries to the classpath
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue