Module ImportFrom alias alias Import alias Import alias Import alias Import alias Import alias Assign NameStore Str Assign NameStore Str Assign NameStore Str ClassDef bases NameLoad body Expr Str Assign NameStore ListLoad Assign NameStore Str Assign NameStore Dict FunctionDef arguments args NameParam NameParam defaults body Expr Str If Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad body Assign NameStore Call NameLoad BinOpMod Str NameLoad If CompareNotEq Call AttributeLoad NameLoad attr Str body Print Str Expr Call AttributeLoad NameLoad attr Num Assign AttributeStore NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str For NameStore Call NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Raise NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign AttributeStore NameLoad attr Call NameLoad AttributeLoad NameLoad attr Str Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr Print BinOpMod Str AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Expr Call AttributeLoad NameLoad attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str TupleLoad Call AttributeLoad Str attr AttributeLoad NameLoad attr Expr Call AttributeLoad NameLoad attr decorator_list FunctionDef arguments args NameParam defaults body Expr Str Assign NameStore GeneratorExp BinOpMult Str BinOpAdd Call NameLoad NameLoad Num comprehension NameStore AttributeLoad NameLoad attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod Str Call AttributeLoad Str attr NameLoad decorator_list FunctionDef arguments args NameParam defaults body Expr Str For TupleStore NameStore NameStore Call NameLoad Call AttributeLoad AttributeLoad NameLoad attr attr body Assign TupleStore NameStore NameStore NameStore NameLoad Expr Call AttributeLoad AttributeLoad NameLoad attr attr BinOpMod AttributeLoad NameLoad attr TupleLoad NameLoad NameLoad NameLoad NameLoad decorator_list decorator_list ClassDef bases NameLoad body Expr Str Assign NameStore ListLoad Str Str Str Str Assign NameStore BinOpMod Str Call NameLoad ListComp Call NameLoad NameLoad comprehension NameStore NameLoad FunctionDef arguments args NameParam NameParam defaults body Expr Str Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr Assign AttributeStore NameLoad attr Call AttributeLoad NameLoad attr Expr Call AttributeLoad AttributeLoad NameLoad attr attr NameLoad decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Str Assign NameStore BinOpPow Num NameLoad Assign NameStore NameLoad While NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore BinOpFloorDiv NameLoad Num decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Assign TupleStore NameStore NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad Assign NameStore TupleLoad NameLoad NameLoad NameLoad Assign SubscriptStore AttributeLoad NameLoad attr Index NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam defaults body Expr Str Assign NameStore BinOpMult Str NameLoad Assign NameStore BinOpMult NameLoad NameLoad Assign AttributeStore AttributeLoad NameLoad attr attr NameLoad Assign NameStore BinOpAdd Call AttributeLoad NameLoad attr Call AttributeLoad NameLoad attr NameLoad Num Return TupleLoad NameLoad NameLoad decorator_list FunctionDef arguments args NameParam NameParam NameParam NameParam defaults body Assign NameStore AttributeLoad AttributeLoad NameLoad attr attr Assign NameStore Call AttributeLoad NameLoad attr Expr Call NameLoad BinOpMod NameLoad TupleLoad NameLoad For NameStore Call NameLoad NameLoad body Expr Call NameLoad NameLoad Expr Call NameLoad NameLoad Assign NameStore BinOpSub Call AttributeLoad NameLoad attr NameLoad Assert AttributeLoad AttributeLoad NameLoad attr attr Str Return NameLoad decorator_list decorator_list FunctionDef arguments args defaults body Expr Call AttributeLoad NameLoad attr Print Str decorator_list FunctionDef arguments args NameParam NameParam defaults body Expr Call NameLoad Assign NameStore Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr decorator_list If CompareEq NameLoad Str body If CompareLt Call NameLoad AttributeLoad NameLoad attr Num body Print BinOpMod NameLoad SubscriptLoad AttributeLoad NameLoad attr Index Num Expr Call AttributeLoad NameLoad attr Num Expr Call NameLoad SubscriptLoad AttributeLoad NameLoad attr Slice Num Num
N/A twisted.test proto_helpers test_protocols N/A math N/A time N/A sys N/A os N/A gc N/A NETSTRING_PREFIX_TEMPLATE %d: N/A NETSTRING_POSTFIX , N/A USAGE Usage: %s <number> <filename>

This script creates up to 2 ** <number> chunks with up to 2 **
<number> characters and sends them to the NetstringReceiver. The
sorted performance data for all combination is written to <filename>
afterwards.

You might want to start with a small number, maybe 10 or 12, and slowly
increase it. Stop when the performance starts to deteriorate ;-).
 PerformanceTester N/A object N/A N/A 
    A class for testing the performance of some
     N/A headers N/A N/A lineFormat N/A performanceData N/A __init__ N/A N/A self filename N/A N/A N/A 
        Initializes C{self.filename}.

        If a file with this name already exists, asks if it should be
        overwritten. Terminates with exit status 1, if the user does
        not accept.
         N/A N/A N/A N/A os path isfile filename N/A N/A response N/A raw_input N/A A file named %s exists. Overwrite it (y/n)?  filename N/A N/A N/A N/A response lower y N/A N/A Performance test cancelled. N/A N/A N/A sys exit 1 N/A N/A self filename filename N/A testPerformance N/A N/A self number N/A N/A N/A 
        Drives the execution of C{performTest} with arguments between
        0 and C{number - 1}.

        @param number: Defines the number of test runs to be performed.
        @type number: C{int}
         N/A iteration N/A xrange number N/A N/A N/A N/A self performTest iteration N/A performTest N/A N/A self iteration N/A N/A N/A 
        Performs one test iteration. Overwrite this.

        @param iteration: The iteration number. Can be used to configure
            the test.
        @type iteration: C{int}
        @raise NotImplementedError: because this method has to be implemented
            by the subclass.
         N/A NotImplementedError N/A createReport N/A N/A self N/A N/A N/A 
        Creates a file and writes a table with performance data.

        The performance data are ordered by the total size of the netstrings.
        In addition they show the chunk size, the number of chunks and the
        time (in seconds) that elapsed while the C{NetstringReceiver}
        received the netstring.

        @param filename: The name of the report file that will be written.
        @type filename: C{str}
         N/A N/A self outputFile N/A open N/A self filename w N/A N/A N/A self writeHeader N/A N/A N/A self writePerformanceData N/A N/A N/A self writeLineSeparator N/A N/A The report was written to %s. N/A self filename N/A writeHeader N/A N/A self N/A N/A N/A 
        Writes the table header for the report.
         N/A N/A N/A self writeLineSeparator N/A N/A N/A N/A self outputFile write N/A | %s |
 N/A N/A N/A  |  join N/A self headers N/A N/A N/A self writeLineSeparator N/A writeLineSeparator N/A N/A self N/A N/A N/A 
        Writes a 'line separator' made from '+' and '-' characters.
         N/A dashes N/A N/A - N/A N/A len header 2 N/A header N/A self headers N/A N/A N/A N/A self outputFile write N/A +%s+
 N/A N/A + join dashes N/A writePerformanceData N/A N/A self N/A N/A N/A 
        Writes one line for each item in C{self.performanceData}.
         N/A N/A combination elapsed N/A sorted N/A N/A N/A self performanceData iteritems N/A N/A N/A totalSize chunkSize numberOfChunks combination N/A N/A N/A N/A self outputFile write N/A N/A self lineFormat N/A totalSize chunkSize numberOfChunks elapsed N/A N/A NetstringPerformanceTester N/A PerformanceTester N/A N/A 
    A class for determining the C{NetstringReceiver.dataReceived} performance.

    Instantiates a C{NetstringReceiver} and calls its
    C{dataReceived()} method with different chunks sizes and numbers
    of chunks.  Presents a table showing the relation between input
    data and time to process them.
     N/A headers N/A Chunk size Number of chunks Total size Time to receive N/A lineFormat N/A | %%%dd | %%%dd | %%%dd | %%%d.4f |
 N/A tuple N/A N/A len header N/A header headers __init__ N/A N/A self filename N/A N/A N/A 
        Sets up the output file and the netstring receiver that will be
        used for receiving data.

        @param filename: The name of the file for storing the report.
        @type filename: C{str}
         N/A N/A N/A PerformanceTester __init__ self filename N/A transport N/A N/A proto_helpers StringTransport N/A N/A self netstringReceiver N/A N/A test_protocols TestNetstring N/A N/A N/A N/A self netstringReceiver makeConnection transport N/A performTest N/A N/A self number N/A N/A N/A 
        Tests the performance of C{NetstringReceiver.dataReceived}.

        Feeds netstrings of various sizes in different chunk sizes
        to a C{NetstringReceiver} and stores the elapsed time in
        C{self.performanceData}.

        @param number: The maximal chunks size / number of
            chunks to be checked.
        @type number: C{int}
         N/A chunkSize N/A 2 number N/A numberOfChunks chunkSize N/A numberOfChunks N/A N/A N/A N/A self testCombination chunkSize numberOfChunks N/A numberOfChunks N/A numberOfChunks 2 N/A testCombination N/A N/A self chunkSize numberOfChunks N/A N/A N/A 
        Tests one combination of chunk size and number of chunks.

        @param chunkSize: The size of one chunk to be sent to the
            C{NetstringReceiver}.
        @type chunkSize: C{int}
        @param numberOfChunks: The number of C{chunkSize}-sized chunks to
            be sent to the C{NetstringReceiver}.
        @type numberOfChunks: C{int}
         N/A N/A chunk dataSize N/A N/A self configureCombination chunkSize numberOfChunks N/A elapsed N/A N/A self receiveData chunk numberOfChunks dataSize N/A key N/A chunkSize numberOfChunks dataSize N/A N/A N/A self performanceData N/A key elapsed N/A configureCombination N/A N/A self chunkSize numberOfChunks N/A N/A N/A 
        Updates C{MAX_LENGTH} for {self.netstringReceiver} (to avoid
        C{NetstringParseErrors} that might be raised if the size
        exceeds the default C{MAX_LENGTH}).

        Calculates and returns one 'chunk' of data and the total size
        of the netstring.

        @param chunkSize: The size of chunks that will be received.
        @type chunkSize: C{int}
        @param numberOfChunks: The number of C{chunkSize}-sized chunks
            that will be received.
        @type numberOfChunks: C{int}

        @return: A tuple consisting of string of C{chunkSize} 'a'
        characters and the size of the netstring data portion.
         N/A chunk N/A a chunkSize N/A dataSize N/A chunkSize numberOfChunks N/A N/A N/A self netstringReceiver MAX_LENGTH dataSize N/A numberOfDigits N/A N/A N/A math ceil N/A N/A math log10 dataSize 1 N/A N/A chunk dataSize N/A receiveData N/A N/A self chunk numberOfChunks dataSize N/A N/A N/A dr N/A N/A self netstringReceiver dataReceived N/A now N/A N/A time time N/A N/A dr N/A NETSTRING_PREFIX_TEMPLATE N/A dataSize N/A idx N/A xrange numberOfChunks N/A N/A N/A dr chunk N/A N/A dr NETSTRING_POSTFIX N/A elapsed N/A N/A N/A time time now N/A N/A N/A self netstringReceiver received Didn't receive string! N/A elapsed N/A N/A disableGarbageCollector N/A N/A N/A N/A N/A N/A N/A gc disable N/A Disabled Garbage Collector. N/A main N/A N/A number filename N/A N/A N/A N/A disableGarbageCollector N/A npt N/A NetstringPerformanceTester filename N/A N/A N/A npt testPerformance N/A int number N/A N/A N/A npt createReport N/A N/A N/A __name__ __main__ N/A N/A N/A N/A len N/A sys argv 3 N/A N/A N/A USAGE N/A N/A sys argv N/A 0 N/A N/A N/A sys exit 1 N/A N/A main N/A N/A sys argv N/A 1 3