Skip to content

Commit

Permalink
Avoid saving program.dat if we are about to run another chunk anyway.
Browse files Browse the repository at this point in the history
Reverts this aspect of behavior to that prior to the fix of JENKINS-25623.
Also logging time spent saving.
  • Loading branch information
jglick committed Dec 6, 2016
1 parent bea88ca commit 22fa38a
Showing 1 changed file with 9 additions and 1 deletion.
Expand Up @@ -355,7 +355,7 @@ private boolean run() {
}
}

if (changed) {
if (changed && !stillRunnable) {
try {
saveProgram();
} catch (IOException x) {
Expand Down Expand Up @@ -420,6 +420,9 @@ void saveProgram() throws IOException {

@CpsVmThreadOnly
public void saveProgram(File f) throws IOException {
boolean logging = LOGGER.isLoggable(Level.FINER);
long start = logging ? System.nanoTime() : 0;

File dir = f.getParentFile();
File tmpFile = File.createTempFile("atomic",null, dir);

Expand Down Expand Up @@ -452,6 +455,11 @@ public void saveProgram(File f) throws IOException {
PROGRAM_STATE_SERIALIZATION.set(old);
Util.deleteFile(tmpFile);
}

if (logging) {
long end = System.nanoTime();
LOGGER.log(FINER, "saved {0} of size {1}Kb in {2}ms", new Object[] {f, f.length() / 1000, (end - start) / 1000 / 1000});
}
}

/**
Expand Down

0 comments on commit 22fa38a

Please sign in to comment.