Changeset 1419
- Timestamp:
- 10/14/07 14:37:10 (11 months ago)
- Files:
-
- nebula/trunk/src/cluster.c (modified) (1 diff)
- nebula/trunk/src/nebula.c (modified) (10 diffs)
- nebula/trunk/src/nebula.h (modified) (2 diffs)
- nebula/trunk/src/signals.c (modified) (2 diffs)
- nebula/trunk/src/util.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
nebula/trunk/src/cluster.c
r1415 r1419 142 142 cl = list; 143 143 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); 145 145 cluster_free(cl, list_files, cluster_hashq_free); 146 146 } nebula/trunk/src/nebula.c
r1418 r1419 32 32 #include <unistd.h> 33 33 34 #if HAVE_CONFIG_H35 //#include <config.h>36 #endif37 38 34 #include "cluster.h" 39 35 #include "md5.h" … … 51 47 void usage(const char* progname, const int exit_val) { 52 48 #ifdef PROFILE 53 printf("Usage: %s [-l tpv] [-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); 54 50 #else 55 printf("Usage: %s [-l tpv] [-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); 56 52 #endif 57 53 … … 73 69 74 70 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; 88 85 #endif 89 86 … … 91 88 time_sort = 0; // don't process files chronologically 92 89 verbose = 0; // don't be verbose 90 hide_result = 0; // show resulting clusters 93 91 show_progress = 0; // don't show progress dots 94 92 list_files = 0; // don't list cluster objects … … 104 102 // process args 105 103 #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) { 107 105 #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) { 109 107 #endif 110 108 switch(option) { … … 151 149 } 152 150 break; 151 case 's': 152 hide_result = 1; 153 break; 153 154 case 't': 154 155 time_sort = 1; … … 164 165 } 165 166 } 167 168 if (hide_result && list_files) list_files = 0; 166 169 167 170 set_signal_handlers(); … … 199 202 printf("Profiling enabled, printing statistics every %d seconds.\n", alarm_time); 200 203 files_in_interval = 0; 204 bytes_in_interval = 0; 201 205 checkpoint = 0; 202 206 #endif … … 214 218 #ifdef PROFILE 215 219 files_in_interval++; 220 bytes_in_interval += bstr.len; 216 221 #endif 217 222 … … 240 245 if (verbose) printf(" md5sum is %s (%u instances)\n", ((hash*)t->data)->md5sum, ((hash*)t->data)->cnt); 241 246 if (verbose) printf(" absolute match found.\n"); 247 num_of_duplicates++; 242 248 } else { 243 249 // md5sum not in trie, create new element nebula/trunk/src/nebula.h
r1418 r1419 31 31 #include "hashq.h" 32 32 33 u_char verbose, list_files, show_progress ;33 u_char verbose, list_files, show_progress, hide_result; 34 34 int clusterq_max, outlierq_max; 35 35 u_int16_t num_of_clusters; 36 u_int32_t num_of_duplicates; 36 37 float num_of_files, total_files; 37 38 double cluster_radius; … … 43 44 int alarm_time; // number of seconds for profile output interval 44 45 float files_in_interval; 46 float bytes_in_interval; 45 47 u_int32_t checkpoint; 46 48 #endif nebula/trunk/src/signals.c
r1418 r1419 19 19 */ 20 20 21 #include <math.h> 21 22 #include <signal.h> 22 23 #include <stdio.h> … … 42 43 void handle_alarm_signal(int sig) { 43 44 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); 46 53 47 54 checkpoint++; 48 55 files_in_interval = 0; 56 bytes_in_interval = 0; 49 57 alarm(alarm_time); 50 58 nebula/trunk/src/util.c
r1418 r1419 129 129 130 130 // 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 "-----------------------------------------------------------------"); 132 134 133 135 hashq_free(outlierq, 0, hash_free);
