Changeset 2256


Ignore:
Timestamp:
Dec 23, 2010, 4:19:52 PM (11 years ago)
Author:
schwittmann
Message:

ExternalClient: Display progress for each subbatch

Location:
trunk/CrypPlugins/KeySearcher/ExternalClient
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypPlugins/KeySearcher/ExternalClient/Cryptool.cpp

    r2230 r2256  
    101101   
    102102    localCosts = new float[subbatch];
     103    lastSubbatchCompleted = clock();
     104
     105    // required for thousand/million separator in printf
     106    setlocale(LC_ALL,"");
    103107}
    104108
     
    282286    for (int i = 0; i < (size/subbatch); i++)
    283287    {
    284         enqueueSubbatch(queue, keybuffer, costs, i*subbatch, subbatch, j);
     288        enqueueSubbatch(queue, keybuffer, costs, i*subbatch, subbatch, j);
     289
     290        clock_t now = clock();
     291        clock_t timeDiff = now - lastSubbatchCompleted;
     292        lastSubbatchCompleted = now;
     293        printf("% .2f%% done. %'u keys/sec\n", ((i+1)*subbatch)/(float)size*100, (unsigned int)(subbatch/(timeDiff/(float)CLOCKS_PER_SEC)));
    285294    }
    286295
     
    288297    if (remain != 0)
    289298    {
    290         enqueueSubbatch(queue, keybuffer, costs, size-remain, remain, j);
     299        enqueueSubbatch(queue, keybuffer, costs, size-remain, remain, j);
    291300    }
    292301}
  • trunk/CrypPlugins/KeySearcher/ExternalClient/Cryptool.h

    r2230 r2256  
    22
    33#include <CL/cl.hpp>
     4#include <time.h>
     5
    46#include "Job.h"
    57
     
    1517    bool compareLargerThan;
    1618    int resultSize;
     19    clock_t lastSubbatchCompleted;
    1720
    1821        static const int subbatch = 256*256*256;
  • trunk/CrypPlugins/KeySearcher/ExternalClient/Network.cpp

    r2215 r2256  
    8383        return;
    8484    }
    85     printf("Connecting established\n");
     85
    8686    if (connect(sockfd, (sockaddr*)&serv_addr, sizeof(serv_addr)) < 0)
    8787    {
     
    9090        return;
    9191    }
     92    printf("Connection established\n");
    9293
    9394    try{
Note: See TracChangeset for help on using the changeset viewer.