Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

Fop.java 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*
  2. *
  3. * Copyright 1999-2003 The Apache Software Foundation.
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS,
  13. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. *
  17. *
  18. * $Id$
  19. */
  20. package org.apache.fop.apps;
  21. import java.util.logging.Logger;
  22. public class Fop {
  23. public static Runtime runtime;
  24. public static long startTotal;
  25. public static long startFree;
  26. public static long startTime;
  27. public static long startPCi;
  28. public static long endPCi;
  29. /**
  30. * The top-level package for FOP
  31. */
  32. public static final String fopPackage = "org.apache.fop";
  33. protected static final Logger logger = Logger.getLogger(fopPackage);
  34. public static void main(String[] args) {
  35. long endtotal, endfree, gctotal, gcfree;
  36. Driver driver;
  37. Boolean bool = null;
  38. runtime = Runtime.getRuntime();
  39. startTotal = runtime.totalMemory();
  40. startFree = runtime.freeMemory();
  41. startTime = System.currentTimeMillis();
  42. try {
  43. Options.configure(args);
  44. driver = new Driver();
  45. driver.run();
  46. System.out.println("Back from driver.run()");
  47. System.out.println("Elapsed time: " +
  48. (System.currentTimeMillis() - startTime));
  49. endtotal = runtime.totalMemory();
  50. endfree = runtime.freeMemory();
  51. System.gc();
  52. gctotal = runtime.totalMemory();
  53. gcfree = runtime.freeMemory();
  54. System.out.println("Total memory before run : " + startTotal);
  55. System.out.println("Total memory after run : " + endtotal);
  56. System.out.println("Total memory after GC : " + gctotal);
  57. System.out.println("Diff before/after total : "
  58. + (endtotal - startTotal));
  59. System.out.println("Diff before/GC total : "
  60. + (gctotal - startTotal));
  61. System.out.println("Diff after/GC total : "
  62. + (gctotal - endtotal));
  63. System.out.println("Free memory before run : " + startFree);
  64. System.out.println("Free memory after run : " + endfree);
  65. System.out.println("Free memory after GC : " + gcfree);
  66. System.out.println("Diff before/after free : "
  67. + (endfree - startFree));
  68. System.out.println("Diff before/GC free : "
  69. + (gcfree - startFree));
  70. System.out.println("Diff after/GC free : "
  71. + (gcfree - endfree));
  72. System.out.println("cg() freed : "
  73. + (gcfree - endfree));
  74. //System.out.println("PC time : " + (endPCi - startPCi));
  75. } catch (FOPException e) {
  76. logger.warning(e.getMessage());
  77. if ((bool = Options.isDebugMode()) != null
  78. && bool.booleanValue()) {
  79. e.printStackTrace();
  80. }
  81. } catch (java.io.FileNotFoundException e) {
  82. logger.warning(e.getMessage());
  83. if ((bool = Options.isDebugMode()) != null
  84. && bool.booleanValue()) {
  85. e.printStackTrace();
  86. }
  87. }
  88. }
  89. private Fop() {
  90. }
  91. }