adding logging to measure the performance of fingerprint activity.

git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@7282 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
kohsuke committed 2008-03-04 02:21:29 +00:00
1 parent 0cc338099b
commit 0992e7deac
1 file changed
+18 -2
@@ -546,7 +546,15 @@ public class Fingerprint implements ModelObject {
* Save the settings to a file.
*/
public synchronized void save() throws IOException {
getConfigFile(getFingerprintFile(md5sum)).write(this);
long start=0;
if(logger.isLoggable(Level.FINE))
start = System.currentTimeMillis();
File file = getFingerprintFile(md5sum);
getConfigFile(file).write(this);
if(logger.isLoggable(Level.FINE))
logger.fine("Saving fingerprint "+file+" took "+(System.currentTimeMillis()-start)+"ms");
}
public Api getApi() {
@@ -579,8 +587,16 @@ public class Fingerprint implements ModelObject {
XmlFile configFile = getConfigFile(file);
if(!configFile.exists())
return null;
long start=0;
if(logger.isLoggable(Level.FINE))
start = System.currentTimeMillis();
try {
return (Fingerprint)configFile.read();
Fingerprint f = (Fingerprint) configFile.read();
if(logger.isLoggable(Level.FINE))
logger.fine("Loading fingerprint "+file+" took "+(System.currentTimeMillis()-start)+"ms");
return f;
} catch (IOException e) {
logger.log(Level.WARNING, "Failed to load "+configFile,e);
throw e;