Changeset 1251 in josm


Ignore:
Timestamp:
Jan 11, 2009 6:46:15 PM (4 years ago)
Author:
ulfl
Message:

add a profiler also to the SimplePaintVisitor, so can compare details with MapPaint. You can activate it with simplepaint.profiler=true

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/data/osm/visitor/SimplePaintVisitor.java

    r1250 r1251  
    122122 
    123123    public void visitAll(DataSet data, Boolean virtual) { 
     124        boolean profiler = Main.pref.getBoolean("simplepaint.profiler",false); 
     125        long profilerStart = java.lang.System.currentTimeMillis(); 
     126        long profilerLast = profilerStart; 
     127        int profilerN = 0; 
     128        if(profiler) 
     129            System.out.println("Simplepaint Profiler"); 
     130 
    124131        getSettings(virtual); 
     132         
     133        if(profiler)  
     134        { 
     135            System.out.format("Prepare  : %4dms\n", (java.lang.System.currentTimeMillis()-profilerLast)); 
     136            profilerLast = java.lang.System.currentTimeMillis(); 
     137        } 
     138         
    125139        // draw tagged ways first, then untagged ways. takes 
    126140        // time to iterate through list twice, OTOH does not 
    127141        // require changing the colour while painting... 
     142        profilerN = 0; 
    128143        for (final OsmPrimitive osm : data.relations) 
    129144            if (!osm.deleted && !osm.selected) 
     145            { 
    130146                osm.visit(this); 
    131  
     147                profilerN++; 
     148            } 
     149 
     150        if(profiler) 
     151        { 
     152            System.out.format("Relations: %4dms, n=%5d\n", (java.lang.System.currentTimeMillis()-profilerLast), profilerN); 
     153            profilerLast = java.lang.System.currentTimeMillis(); 
     154        } 
     155 
     156        profilerN = 0; 
    132157        for (final OsmPrimitive osm : data.ways) 
    133158            if (!osm.deleted && !osm.selected && osm.tagged) 
     159            { 
    134160                osm.visit(this); 
     161                profilerN++; 
     162            } 
    135163        displaySegments(); 
    136164 
    137165        for (final OsmPrimitive osm : data.ways) 
    138166            if (!osm.deleted && !osm.selected && !osm.tagged) 
     167            { 
    139168                osm.visit(this); 
     169                profilerN++; 
     170            } 
    140171        displaySegments(); 
    141172 
     173        if(profiler) 
     174        { 
     175            System.out.format("Ways     : %4dms, n=%5d\n", 
     176                (java.lang.System.currentTimeMillis()-profilerLast), profilerN); 
     177            profilerLast = java.lang.System.currentTimeMillis(); 
     178        } 
     179 
     180        profilerN = 0; 
    142181        for (final OsmPrimitive osm : data.getSelected()) 
    143182            if (!osm.deleted) 
     183            { 
    144184                osm.visit(this); 
     185                profilerN++; 
     186            } 
    145187        displaySegments(); 
    146188 
     189        if(profiler) 
     190        { 
     191            System.out.format("Selected : %4dms, n=%5d\n", (java.lang.System.currentTimeMillis()-profilerLast), profilerN); 
     192            profilerLast = java.lang.System.currentTimeMillis(); 
     193        } 
     194 
     195        profilerN = 0; 
    147196        for (final OsmPrimitive osm : data.nodes) 
    148197            if (!osm.deleted && !osm.selected) 
     198            { 
    149199                osm.visit(this); 
     200                profilerN++; 
     201            } 
     202        if(profiler) 
     203        { 
     204            System.out.format("Nodes    : %4dms, n=%5d\n", 
     205                (java.lang.System.currentTimeMillis()-profilerLast), profilerN); 
     206            profilerLast = java.lang.System.currentTimeMillis(); 
     207        } 
     208 
    150209        if(virtualNodeSize != 0) 
    151210        { 
     211            profilerN = 0; 
    152212            currentColor = nodeColor; 
    153213            for (final OsmPrimitive osm : data.ways) 
    154214                if (!osm.deleted) 
    155                     visitVirtual((Way)osm); 
     215                    { 
     216                        visitVirtual((Way)osm); 
     217                        profilerN++; 
     218                    } 
    156219            displaySegments(); 
     220 
     221            if(profiler) 
     222            { 
     223                System.out.format("Virtual  : %4dms, n=%5d\n", (java.lang.System.currentTimeMillis()-profilerLast), profilerN); 
     224                profilerLast = java.lang.System.currentTimeMillis(); 
     225            } 
     226        } 
     227 
     228        if(profiler) 
     229        { 
     230            System.out.format("All      : %4dms\n", (profilerLast-profilerStart)); 
    157231        } 
    158232    } 
Note: See TracChangeset for help on using the changeset viewer.