Skip to content

Commit 5cf102a

Browse files
committed
Time mod initializers
1 parent 72e3cce commit 5cf102a

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
## Changelog ##
22
#### dev ####
33
* Fix ClassLoader to retrieve correct DesktopLauncher when invoked via ClassPool
4+
* Time mod initializers
45

56
#### v3.5.0 ####
67
* Cache updater to avoid hitting the rate limit

src/main/java/com/evacipated/cardcrawl/modthespire/Patcher.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,16 @@ public static void initializeMods(ClassLoader loader, ModInfo... modInfos) throw
2828
if (annotationDBMap.containsKey(info.jarURL)) {
2929
Set<String> initializers = annotationDBMap.get(info.jarURL).getAnnotationIndex().get(SpireInitializer.class.getName());
3030
if (initializers != null) {
31+
System.out.println(" - " + info.Name);
3132
for (String initializer : initializers) {
33+
System.out.println(" - " + initializer);
3234
try {
35+
long startTime = System.nanoTime();
3336
Method init = loader.loadClass(initializer).getDeclaredMethod("initialize");
3437
init.invoke(null);
38+
long endTime = System.nanoTime();
39+
long duration = endTime - startTime;
40+
System.out.println(" - " + (duration / 1000000) + "ms");
3541
} catch (NoSuchMethodException e) {
3642
System.out.println("WARNING: Unable to find method initialize() on class marked @SpireInitializer: " + initializer);
3743
}

0 commit comments

Comments
 (0)