Changeset 548 for Tests


Ignore:
Timestamp:
04/24/12 20:39:01 (10 years ago)
Author:
BegemoT
Message:
 
Location:
Tests/JAVA/test
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • Tests/JAVA/test/pom.xml

    r442 r548  
    289289                        </goals> 
    290290                        <configuration> 
    291                             <finalName>queue-benchmark</finalName> 
     291                            <finalName>vania</finalName> 
    292292                            <shadedArtifactAttached>true</shadedArtifactAttached> 
    293293                            <shadedClassifierName>full</shadedClassifierName> 
     294                            <artifactSet> 
     295                                <excludes> 
     296                                    <exclude>junit:*</exclude> 
     297                                    <exclude>jmock:*</exclude> 
     298                                    <exclude>*:xml-apis</exclude> 
     299                                    <exclude>*:disruptor</exclude> 
     300                                    <exclude>*:jetlang</exclude> 
     301                                    <exclude>*:jna</exclude> 
     302                                </excludes> 
     303                            </artifactSet> 
    294304                            <transformers> 
    295305                                <transformer 
    296306                                        implementation = "org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> 
    297307                                    <manifestEntries> 
    298                                         <Main-Class>test.threads.queue.unstressed.QueuesVsDisruptorUnstressedBenchmark</Main-Class> 
     308                                        <Main-Class>test.ivan.Main</Main-Class> 
    299309                                    </manifestEntries> 
    300310                                </transformer> 
  • Tests/JAVA/test/src/main/java/test/ivan/Main.java

    r547 r548  
    22 
    33import java.io.*; 
    4 import java.util.Arrays; 
    5 import java.util.Formatter; 
     4import java.util.*; 
    65 
    76import com.google.common.base.Function; 
     
    3837        ); 
    3938 
    40         options.addOption( OptionBuilder.withLongOpt( "output" ) 
    41                                    .withDescription( "output file to write results" ) 
    42                                    .hasArg() 
    43                                    .isRequired() 
    44                                    .withArgName( "OUTPUT" ) 
    45                                    .create() 
    46         ); 
    47  
    4839        options.addOption( OptionBuilder.withArgName( "property=value" ) 
    4940                                   .hasArgs( 2 ) 
     
    7061            final File outputFile = new File( outputFilePath ); 
    7162 
     63 
     64            final Properties properties = cmd.getOptionProperties( "D" ); 
     65            final int bufferSize = 1 << 20; 
     66 
    7267            System.out.printf( 
    7368                    "Processing [%s], writing results to [%s]\n", 
     
    7570                    outputFile.getAbsolutePath() 
    7671            ); 
    77             process( inputFile, outputFile, 1 << 20 ); 
     72 
     73            process( inputFile, outputFile, bufferSize ); 
    7874        } finally { 
    7975 
     
    9389                    try { 
    9490                        final PacketEntryProcessor processor = new PacketEntryProcessor( ps ); 
     91 
    9592                        FileParser.forEachEntry( is, processor ); 
     93 
     94                        processor.finish(); 
    9695                    } finally { 
    9796                        ps.close(); 
     
    111110    private static class PacketEntryProcessor implements Function<PacketEntry, Boolean> { 
    112111        private static final int INITIAL_CAPACITY = 1 << 20; // =1Mb 
     112        private static final int PRINT_PROGRESS = 1 << 14; // =16K 
    113113 
    114114        private final TObjectLongHashMap<byte[]> timestampByHash = new TObjectLongHashMap<byte[]>( 
     
    123123        } 
    124124 
     125        private long entriesCount = 0; 
     126 
    125127        @Override 
    126128        public Boolean apply( final PacketEntry entry ) { 
     129            entriesCount++; 
     130            if ( ( entriesCount % PRINT_PROGRESS ) == 0 ) { 
     131                System.out.printf( "%d entries processed\n", entriesCount ); 
     132            } 
     133 
    127134            final byte[] hash = entry.hash(); 
    128135            final long packetInTimestamp = timestampByHash.get( hash ); 
     
    144151 
    145152        public void finish() { 
    146             System.out.printf( "Finishing: %d entries unpaired\n", timestampByHash.size() ); 
     153            System.out.printf( 
     154                    "Finishing: \n%d entries total, %d unpaired\n", 
     155                    entriesCount, 
     156                    timestampByHash.size() 
     157            ); 
    147158        } 
    148159    } 
  • Tests/JAVA/test/test.iws

    r547 r548  
    4141  <component name="ChangeListManager"> 
    4242    <list default="true" readonly="true" id="6898b49f-ea82-4df2-ad6c-da63a3fe4f9a" name="Default" comment=""> 
    43       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/main/java/test/ivan/FileParser.java" afterPath="$PROJECT_DIR$/src/main/java/test/ivan/FileParser.java" /> 
     43      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/pom.xml" afterPath="$PROJECT_DIR$/pom.xml" /> 
    4444      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/main/java/test/ivan/Main.java" afterPath="$PROJECT_DIR$/src/main/java/test/ivan/Main.java" /> 
    45       <change type="MODIFICATION" beforePath="$PROJECT_DIR$/src/main/java/test/ivan/PacketEntry.java" afterPath="$PROJECT_DIR$/src/main/java/test/ivan/PacketEntry.java" /> 
    4645      <change type="MODIFICATION" beforePath="$PROJECT_DIR$/test.iws" afterPath="$PROJECT_DIR$/test.iws" /> 
    4746    </list> 
     
    160159        <option name="LOG_MESSAGE" value="" /> 
    161160      </breakpoint> 
    162       <breakpoint url="file://$PROJECT_DIR$/src/main/java/test/ivan/Main.java" line="129" class="test.ivan.Main.PacketEntryProcessor" package="test.ivan"> 
     161      <breakpoint url="file://$PROJECT_DIR$/src/main/java/test/ivan/Main.java" line="136" class="test.ivan.Main.PacketEntryProcessor" package="test.ivan"> 
    163162        <option name="ENABLED" value="true" /> 
    164163        <option name="LOG_ENABLED" value="false" /> 
     
    243242        <entry file="file://$PROJECT_DIR$/src/main/java/test/ivan/Main.java"> 
    244243          <provider selected="true" editor-type-id="text-editor"> 
    245             <state line="138" column="64" selection-start="5378" selection-end="5378" vertical-scroll-proportion="0.5608108"> 
     244            <state line="155" column="20" selection-start="5704" selection-end="5704" vertical-scroll-proportion="0.8391892"> 
    246245              <folding /> 
    247246            </state> 
     
    249248        </entry> 
    250249      </file> 
    251       <file leaf-file-name="res.txt" pinned="false" current="false" current-in-tab="false"> 
    252         <entry file="file://$PROJECT_DIR$/res.txt"> 
     250      <file leaf-file-name="pom.xml" pinned="false" current="false" current-in-tab="false"> 
     251        <entry file="file://$PROJECT_DIR$/pom.xml"> 
    253252          <provider selected="true" editor-type-id="text-editor"> 
    254             <state line="0" column="0" selection-start="0" selection-end="0" vertical-scroll-proportion="0.0"> 
     253            <state line="295" column="50" selection-start="10140" selection-end="10140" vertical-scroll-proportion="0.0"> 
    255254              <folding /> 
    256255            </state> 
     
    272271    <option name="changedFiles"> 
    273272      <list> 
    274         <option value="$PROJECT_DIR$/src/main/java/test/threads/queue/unstressed/impl/ABQBusyWaitQueue.java" /> 
    275         <option value="$MAVEN_REPOSITORY$/com/googlecode/disruptor/disruptor/2.8/disruptor-2.8-sources.jar!/com/lmax/disruptor/SequenceBarrier.java" /> 
    276273        <option value="$MAVEN_REPOSITORY$/com/googlecode/disruptor/disruptor/2.8/disruptor-2.8-sources.jar!/com/lmax/disruptor/BusySpinWaitStrategy.java" /> 
    277274        <option value="$PROJECT_DIR$/src/main/java/com/lmax/disruptor/UnpaddedSingleThreadedClaimStrategy.java" /> 
     
    287284        <option value="$PROJECT_DIR$/src/main/java/test/ivan/PacketEntry.java" /> 
    288285        <option value="$PROJECT_DIR$/src/main/java/test/ivan/FileParser.java" /> 
     286        <option value="$PROJECT_DIR$/res.txt" /> 
     287        <option value="$PROJECT_DIR$/pom.xml" /> 
    289288        <option value="$PROJECT_DIR$/src/main/java/test/ivan/Main.java" /> 
    290289      </list> 
     
    720719              <option name="myItemId" value="test" /> 
    721720              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" /> 
     721            </PATH_ELEMENT> 
     722            <PATH_ELEMENT> 
     723              <option name="myItemId" value="External Libraries" /> 
     724              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ExternalLibrariesNode" /> 
    722725            </PATH_ELEMENT> 
    723726          </PATH> 
     
    18431846      <window_info id="Maven Projects" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.3298969" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" /> 
    18441847      <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.3994253" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" /> 
    1845       <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.120057516" sideWeight="0.40664962" order="0" side_tool="false" content_ui="tabs" /> 
     1848      <window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.0790798" sideWeight="0.39897698" order="0" side_tool="false" content_ui="tabs" /> 
    18461849      <window_info id="Dependency Viewer" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="14" side_tool="false" content_ui="tabs" /> 
    18471850      <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.601023" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" /> 
     
    19351938  </component> 
    19361939  <component name="editorHistoryManager"> 
    1937     <entry file="jar://$MAVEN_REPOSITORY$/com/google/guava/guava/r08/guava-r08-sources.jar!/com/google/common/io/Files.java"> 
    1938       <provider selected="true" editor-type-id="text-editor"> 
    1939         <state line="597" column="27" selection-start="20421" selection-end="20421" vertical-scroll-proportion="0.0"> 
    1940           <folding /> 
    1941         </state> 
    1942       </provider> 
    1943     </entry> 
    19441940    <entry file="jar://$MAVEN_REPOSITORY$/com/google/guava/guava/r07/guava-r07-sources.jar!/com/google/common/io/ByteStreams.java"> 
    19451941      <provider selected="true" editor-type-id="text-editor"> 
     
    20482044      </provider> 
    20492045    </entry> 
     2046    <entry file="file://$PROJECT_DIR$/src/main/java/test/ivan/FileParser.java"> 
     2047      <provider selected="true" editor-type-id="text-editor"> 
     2048        <state line="58" column="24" selection-start="2358" selection-end="2358" vertical-scroll-proportion="0.0"> 
     2049          <folding /> 
     2050        </state> 
     2051      </provider> 
     2052    </entry> 
    20502053    <entry file="file://$PROJECT_DIR$/res.txt"> 
    20512054      <provider selected="true" editor-type-id="text-editor"> 
     
    20552058      </provider> 
    20562059    </entry> 
    2057     <entry file="file://$PROJECT_DIR$/src/main/java/test/ivan/FileParser.java"> 
     2060    <entry file="file://$PROJECT_DIR$/pom.xml"> 
    20582061      <provider selected="true" editor-type-id="text-editor"> 
    2059         <state line="58" column="24" selection-start="2358" selection-end="2358" vertical-scroll-proportion="0.0"> 
     2062        <state line="295" column="50" selection-start="10140" selection-end="10140" vertical-scroll-proportion="0.0"> 
    20602063          <folding /> 
    20612064        </state> 
     
    20642067    <entry file="file://$PROJECT_DIR$/src/main/java/test/ivan/Main.java"> 
    20652068      <provider selected="true" editor-type-id="text-editor"> 
    2066         <state line="138" column="64" selection-start="5378" selection-end="5378" vertical-scroll-proportion="0.5608108"> 
     2069        <state line="155" column="20" selection-start="5704" selection-end="5704" vertical-scroll-proportion="0.8391892"> 
    20672070          <folding /> 
    20682071        </state> 
Note: See TracChangeset for help on using the changeset viewer.