Skip to content

Commit 2078cee

Browse files
committed
Simplify fmtscan messages
The statistics were used to measure how fast the scanner can be. Since the messages were intended as internal information, it is not necessary to dump during each code scanning. Change-Id: I938258a5cb359507d2a36725637ea7c2724f1380
1 parent e3b2d26 commit 2078cee

File tree

1 file changed

+0
-28
lines changed

1 file changed

+0
-28
lines changed

tools/fmtscan.c

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,6 @@
4646
/* Analyze all literal strings instead of print statements */
4747
#define OPT_PARSE_STRINGS (0x00000040)
4848

49-
#define FLOAT_TINY (0.0000001)
50-
#define FLOAT_CMP(a, b) (fabs(a - b) < FLOAT_TINY)
51-
5249
#define PARSER_OK (0)
5350
#define PARSER_COMMENT_FOUND (1)
5451
#define PARSER_EOF (256)
@@ -446,17 +443,6 @@ static void check_words(token_t *token)
446443
return;
447444
}
448445

449-
/* Retrieve the current time as a double. */
450-
static double gettime_to_double(void)
451-
{
452-
struct timeval tv;
453-
454-
if (UNLIKELY(gettimeofday(&tv, NULL) < 0))
455-
return 0.0;
456-
457-
return (double) tv.tv_sec + ((double) tv.tv_usec / 1000000);
458-
}
459-
460446
/* Set up a new parser instance. */
461447
static inline void parser_new(parser_t *restrict p,
462448
unsigned char *restrict data,
@@ -1603,7 +1589,6 @@ static void set_is_not_identifier(void)
16031589
int main(int argc, char **argv)
16041590
{
16051591
token_t t, line, str;
1606-
double t1, t2;
16071592
static char buffer[65536];
16081593

16091594
token_cat = token_cat_normal;
@@ -1641,7 +1626,6 @@ int main(int argc, char **argv)
16411626
fflush(stdout);
16421627
setvbuf(stdout, buffer, _IOFBF, sizeof(buffer));
16431628

1644-
t1 = gettime_to_double();
16451629
if (argc == optind) {
16461630
parse_path(".", &t, &line, &str);
16471631
optind++;
@@ -1651,35 +1635,23 @@ int main(int argc, char **argv)
16511635
optind++;
16521636
}
16531637
}
1654-
t2 = gettime_to_double();
16551638

16561639
token_free(&str);
16571640
token_free(&line);
16581641
token_free(&t);
16591642

16601643
dump_bad_spellings();
16611644

1662-
printf("%" PRIu32 " files scanned\n", files);
16631645
printf("%" PRIu32
16641646
" lines scanned (%.3f"
16651647
"M bytes)\n",
16661648
lines, (float) bytes_total / (float) (1024 * 1024));
1667-
if (words) {
1668-
size_t nodes = word_node_heap_next - word_node_heap;
1669-
printf("%" PRIu32 " words and %zd nodes in dictionary heap\n", words,
1670-
nodes);
1671-
printf("%" PRIu32 " chars mapped to %zd bytes of heap, ratio=1:%.2f\n",
1672-
dict_size, nodes * sizeof(word_node_t),
1673-
(float) nodes * sizeof(word_node_t) / dict_size);
1674-
}
16751649
printf("%zu printf style statements being processed\n",
16761650
SIZEOF_ARRAY(printfs));
16771651
if (bad_spellings)
16781652
printf("%" PRIu32 " unique bad spellings found (%" PRIu32
16791653
" non-unique)\n",
16801654
bad_spellings, bad_spellings_total);
1681-
printf("scanned %.2f lines per second\n",
1682-
FLOAT_CMP(t1, t2) ? 0.0 : (double) lines / (t2 - t1));
16831655

16841656
fflush(stdout);
16851657

0 commit comments

Comments
 (0)