You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pdfbox.apache.org by ti...@apache.org on 2021/11/10 18:45:12 UTC

svn commit: r1894925 - /pdfbox/branches/2.0/debugger/src/main/java/org/apache/pdfbox/debugger/PDFDebugger.java

Author: tilman
Date: Wed Nov 10 18:45:12 2021
New Revision: 1894925

URL: http://svn.apache.org/viewvc?rev=1894925&view=rev
Log:
PDFBOX-2941: log parsing duration

Modified:
    pdfbox/branches/2.0/debugger/src/main/java/org/apache/pdfbox/debugger/PDFDebugger.java

Modified: pdfbox/branches/2.0/debugger/src/main/java/org/apache/pdfbox/debugger/PDFDebugger.java
URL: http://svn.apache.org/viewvc/pdfbox/branches/2.0/debugger/src/main/java/org/apache/pdfbox/debugger/PDFDebugger.java?rev=1894925&r1=1894924&r2=1894925&view=diff
==============================================================================
--- pdfbox/branches/2.0/debugger/src/main/java/org/apache/pdfbox/debugger/PDFDebugger.java (original)
+++ pdfbox/branches/2.0/debugger/src/main/java/org/apache/pdfbox/debugger/PDFDebugger.java Wed Nov 10 18:45:12 2021
@@ -1357,7 +1357,12 @@ public class PDFDebugger extends JFrame
             @Override
             PDDocument open() throws IOException
             {
-                return PDDocument.load(file, password);
+                long t0 = System.nanoTime();
+                PDDocument doc = PDDocument.load(file, password);
+                long t1 = System.nanoTime();
+                long ms = TimeUnit.MILLISECONDS.convert(t1 - t0, TimeUnit.NANOSECONDS);
+                LOG.info("Parsed in " + ms + " ms");
+                return doc;
             }
         };
         document = documentOpener.parse();
@@ -1397,7 +1402,12 @@ public class PDFDebugger extends JFrame
             @Override
             PDDocument open() throws IOException
             {
-                return PDDocument.load(new URL(urlString).openStream(), password);
+                long t0 = System.nanoTime();
+                PDDocument doc = PDDocument.load(new URL(urlString).openStream(), password);
+                long t1 = System.nanoTime();
+                long ms = TimeUnit.MILLISECONDS.convert(t1 - t0, TimeUnit.NANOSECONDS);
+                LOG.info("Parsed in " + ms + " ms");
+                return doc;
             }
         };
         document = documentOpener.parse();