Skip to content

Commit

Permalink
#3468 show time in logs
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Nov 6, 2024
1 parent 15c4b47 commit 181655b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ public final class AssembleMojo extends SafeMojo {

@Override
public void exec() {
final long begin = System.currentTimeMillis();
if (this.central == null) {
this.central = new Central(this.project, this.session, this.manager);
}
Expand Down Expand Up @@ -261,8 +262,11 @@ public void exec() {
before = after;
}
Logger.info(
this, "%d assemble cycle(s) produced some new object(s): %s",
cycle, before
this,
"%d assemble cycle(s) produced some new object(s) in %[ms]s: %s",
cycle,
System.currentTimeMillis() - begin,
before
);
}
}
10 changes: 7 additions & 3 deletions eo-maven-plugin/src/main/java/org/eolang/maven/ParseMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public final class ParseMojo extends SafeMojo {

@Override
public void exec() {
final long start = System.currentTimeMillis();
final int total = new SumOf(
new Threads<>(
Runtime.getRuntime().availableProcessors(),
Expand All @@ -102,12 +103,15 @@ public void exec() {
).intValue();
if (0 == total) {
if (this.scopedTojos().withSources().isEmpty()) {
Logger.info(this, "No .eo sources need to be parsed to XMIRs");
Logger.info(this, "No new .eo sources need to be parsed to XMIRs");
} else {
Logger.info(this, "No .eo sources parsed to XMIRs");
Logger.info(this, "No new .eo sources parsed to XMIRs");
}
} else {
Logger.info(this, "Parsed %d .eo sources to XMIRs", total);
Logger.info(
this, "Parsed %d new .eo sources to XMIRs in %[ms]s",
total, System.currentTimeMillis() - start
);
}
}

Expand Down
6 changes: 4 additions & 2 deletions eo-maven-plugin/src/main/java/org/eolang/maven/ShakeMojo.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public final class ShakeMojo extends SafeMojo {

@Override
void exec() {
final long start = System.currentTimeMillis();
final Collection<ForeignTojo> tojos = this.scopedTojos().withOptimized();
final Optimization optimization = this.optimization();
final int total = new SumOf(
Expand All @@ -96,8 +97,9 @@ void exec() {
if (total > 0) {
Logger.info(
this,
"Shaken %d out of %d XMIR program(s)", total,
tojos.size()
"Shaken %d out of %d XMIR program(s) in %[ms]s",
total, tojos.size(),
System.currentTimeMillis() - start
);
} else {
Logger.debug(this, "No XMIR programs out of %d shaken", tojos.size());
Expand Down

0 comments on commit 181655b

Please sign in to comment.