Changeset 1419

Show
Ignore:
Timestamp:
10/14/07 14:37:10 (11 months ago)
Author:
till
Message:

nebula
- more profiling info added

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • nebula/trunk/src/cluster.c

    r1415 r1419  
    142142                cl = list; 
    143143                list = cl->next; 
    144                 printf("Cluster has %u entries.\n", cl->hq->size); 
     144                if (!hide_result) printf("Cluster has %u entries.\n", cl->hq->size); 
    145145                cluster_free(cl, list_files, cluster_hashq_free); 
    146146        } 
  • nebula/trunk/src/nebula.c

    r1418 r1419  
    3232#include <unistd.h> 
    3333 
    34 #if HAVE_CONFIG_H 
    35 //#include <config.h> 
    36 #endif 
    37  
    3834#include "cluster.h" 
    3935#include "md5.h" 
     
    5147void usage(const char* progname, const int exit_val) { 
    5248#ifdef PROFILE 
    53         printf("Usage: %s [-ltpv] [-c maximum cluster size] [-r cluster radius] [-q maximum outlier queue size] [-d directory] [file ...]\n", progname); 
     49        printf("Usage: %s [-lpstv] [-c maximum cluster size] [-r cluster radius] [-q maximum outlier queue size] [-d directory] [file ...]\n", progname); 
    5450#else 
    55         printf("Usage: %s [-ltpv] [-a profiling interval] [-c maximum cluster size] [-r cluster radius] [-q maximum outlier queue size] [-d directory] [file ...]\n", progname); 
     51        printf("Usage: %s [-lpstv] [-a profiling interval] [-c maximum cluster size] [-r cluster radius] [-q maximum outlier queue size] [-d directory] [file ...]\n", progname); 
    5652#endif 
    5753 
     
    7369 
    7470 
    75         dirname         = NULL; 
    76  
    77         outlierq        = NULL; 
    78         cluster_list    = NULL; 
    79  
    80         content         = NULL; 
    81         num_of_files    = 0; 
    82         num_of_clusters = 0; 
    83         i               = 0; 
    84         qsize           = 0; 
    85         total_files     = 0; 
    86 #ifdef PROFILE 
    87         alarm_time      = 5; 
     71        dirname                 = NULL; 
     72 
     73        outlierq                = NULL; 
     74        cluster_list            = NULL; 
     75 
     76        content                 = NULL; 
     77        num_of_files            = 0; 
     78        num_of_clusters         = 0; 
     79        num_of_duplicates       = 0; 
     80        i                       = 0; 
     81        qsize                   = 0; 
     82        total_files             = 0; 
     83#ifdef PROFILE 
     84        alarm_time              = 5; 
    8885#endif 
    8986 
     
    9188        time_sort               = 0;    // don't process files chronologically 
    9289        verbose                 = 0;    // don't be verbose 
     90        hide_result             = 0;    // show resulting clusters 
    9391        show_progress           = 0;    // don't show progress dots 
    9492        list_files              = 0;    // don't list cluster objects 
     
    104102        // process args 
    105103#ifdef PROFILE 
    106         while((option = getopt(argc, argv, "c:q:a:tplvd:r:h?")) > 0) { 
     104        while((option = getopt(argc, argv, "c:q:a:stplvd:r:h?")) > 0) { 
    107105#else 
    108         while((option = getopt(argc, argv, "c:q:tplvd:r:h?")) > 0) { 
     106        while((option = getopt(argc, argv, "c:q:stplvd:r:h?")) > 0) { 
    109107#endif 
    110108                switch(option) { 
     
    151149                                } 
    152150                                break; 
     151                        case 's': 
     152                                hide_result = 1; 
     153                                break; 
    153154                        case 't': 
    154155                                time_sort = 1; 
     
    164165                } 
    165166        } 
     167 
     168        if (hide_result && list_files) list_files = 0; 
    166169 
    167170        set_signal_handlers(); 
     
    199202        printf("Profiling enabled, printing statistics every %d seconds.\n", alarm_time); 
    200203        files_in_interval = 0; 
     204        bytes_in_interval = 0; 
    201205        checkpoint = 0; 
    202206#endif 
     
    214218#ifdef PROFILE 
    215219                files_in_interval++; 
     220                bytes_in_interval += bstr.len; 
    216221#endif 
    217222 
     
    240245                        if (verbose) printf("    md5sum is %s (%u instances)\n", ((hash*)t->data)->md5sum, ((hash*)t->data)->cnt); 
    241246                        if (verbose) printf("    absolute match found.\n"); 
     247                        num_of_duplicates++; 
    242248                } else { 
    243249                        // md5sum not in trie, create new element 
  • nebula/trunk/src/nebula.h

    r1418 r1419  
    3131#include "hashq.h" 
    3232 
    33 u_char          verbose, list_files, show_progress
     33u_char          verbose, list_files, show_progress, hide_result
    3434int             clusterq_max, outlierq_max;  
    3535u_int16_t       num_of_clusters; 
     36u_int32_t       num_of_duplicates; 
    3637float           num_of_files, total_files; 
    3738double          cluster_radius; 
     
    4344int             alarm_time;     // number of seconds for profile output interval 
    4445float           files_in_interval; 
     46float           bytes_in_interval; 
    4547u_int32_t       checkpoint; 
    4648#endif 
  • nebula/trunk/src/signals.c

    r1418 r1419  
    1919 */ 
    2020 
     21#include <math.h> 
    2122#include <signal.h> 
    2223#include <stdio.h> 
     
    4243void handle_alarm_signal(int sig) { 
    4344        if (show_progress) printf("\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\n"); 
    44         printf("%u: %u files form %u clusters (%.0f files per second).\n", 
    45                 checkpoint, (unsigned int) num_of_files, num_of_clusters, files_in_interval/alarm_time); 
     45        printf("%*u | files: %*u\tcluster: %*u\toutlier: %*u\tduplicates: %*u \tfiles/second: %*.0f\tbytes/second: %*u\n", 
     46                6, checkpoint, 
     47                8, (unsigned int) num_of_files, 
     48                5, num_of_clusters, 
     49                7, outlierq->size, 
     50                7, num_of_duplicates, 
     51                6, files_in_interval/alarm_time, 
     52                9, (unsigned int) bytes_in_interval/alarm_time); 
    4653 
    4754        checkpoint++; 
    4855        files_in_interval = 0; 
     56        bytes_in_interval = 0; 
    4957        alarm(alarm_time); 
    5058 
  • nebula/trunk/src/util.c

    r1418 r1419  
    129129 
    130130        // free data structures 
    131         printf("%u files form %u clustes.\n-----------------------\n", (unsigned int) num_of_files, num_of_clusters); 
     131        if (!hide_result) printf("%u files form %u clustes and %u outliers (%u duplicates).\n%s\n", 
     132                (unsigned int) num_of_files, num_of_clusters, outlierq->size, num_of_duplicates, 
     133                "-----------------------------------------------------------------"); 
    132134 
    133135        hashq_free(outlierq, 0, hash_free);