Debian Codegraph @

src/org/stathissideris/ascii2image/core/PerformanceTester.java

raw symbols ◀ ▶ SCIP
1 Debian patch touch this file
•1 /**
2 * ditaa - Diagrams Through Ascii Art
3 *
4 * Copyright (C) 2004-2011 Efstathios Sideris
5 *
6 * ditaa is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as
8 * published by the Free Software Foundation, either version 3 of
9 * the License, or (at your option) any later version.
10 *
11 * ditaa is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with ditaa. If not, see <http://www.gnu.org/licenses/>.
18 *
19 */
20 package org.stathissideris.ascii2image.core;
21
22 import java.io.FileNotFoundException;
23 import java.io.IOException;
24
25 import org.stathissideris.ascii2image.graphics.Diagram;
26 import org.stathissideris.ascii2image.text.TextGrid;
27
28 /**
29 *
30 * @author Efstathios Sideris
31 */
32 public class PerformanceTester {
33
34 public static void main(String[] args){
35
36 String inputFilename = "tests/text/ditaa_bug.txt";
37 ConversionOptions options = new ConversionOptions();
38
39 int iterations = 30;
40
41 try {
42 long a = java.lang.System.currentTimeMillis();
43
44 for(int i = 0; i < iterations; i++) {
45 System.out.println("iteration "+i);
46
47 TextGrid grid = new TextGrid();
48 grid.loadFrom(inputFilename);
49 new Diagram(grid, options);
50 }
51
52 long b = java.lang.System.currentTimeMillis();
53
54 System.out.println((b-a) + "msec for " + iterations + " iterations on "+inputFilename);
55
56 } catch (FileNotFoundException e) {
57 e.printStackTrace();
58 } catch (IOException e) {
59 e.printStackTrace();
60 }
61
62 System.out.println("Tests completed");
63 }
64 }