Fossil SCM
Add the test-command-stats command.
Commit
c7bb647f7ac04b2a162e1cb2eba3fc1a3062cc7c24c851f9d3eba8d4eb230147
Parent
22645e1f0606b5e…
1 file changed
+34
+34
| --- src/dispatch.c | ||
| +++ src/dispatch.c | ||
| @@ -310,10 +310,44 @@ | ||
| 310 | 310 | }else{ |
| 311 | 311 | fossil_print("---\n"); |
| 312 | 312 | } |
| 313 | 313 | version_cmd(); |
| 314 | 314 | } |
| 315 | + | |
| 316 | +/* | |
| 317 | +** Count the number of entries in the aCommand[] table that match | |
| 318 | +** the given flag. | |
| 319 | +*/ | |
| 320 | +static int countCmds(unsigned int eFlg){ | |
| 321 | + int n = 0; | |
| 322 | + int i; | |
| 323 | + for(i=0; i<MX_COMMAND; i++){ | |
| 324 | + if( (aCommand[i].eCmdFlags & eFlg)!=0 ) n++; | |
| 325 | + } | |
| 326 | + return n; | |
| 327 | +} | |
| 328 | + | |
| 329 | +/* | |
| 330 | +** COMMAND: test-command-stats | |
| 331 | +** | |
| 332 | +** Print statistics about the built-in command dispatch table. | |
| 333 | +*/ | |
| 334 | +void test_command_stats_cmd(void){ | |
| 335 | + fossil_print("commands: %4d\n", | |
| 336 | + countCmds( CMDFLAG_COMMAND )); | |
| 337 | + fossil_print(" 1st tier %4d\n", | |
| 338 | + countCmds( CMDFLAG_1ST_TIER )); | |
| 339 | + fossil_print(" 2nd tier %4d\n", | |
| 340 | + countCmds( CMDFLAG_2ND_TIER )); | |
| 341 | + fossil_print(" test %4d\n", | |
| 342 | + countCmds( CMDFLAG_TEST )); | |
| 343 | + fossil_print("web-pages: %4d\n", | |
| 344 | + countCmds( CMDFLAG_WEBPAGE )); | |
| 345 | + fossil_print("settings: %4d\n", | |
| 346 | + countCmds( CMDFLAG_SETTING )); | |
| 347 | + fossil_print("total entries: %4d\n", MX_COMMAND); | |
| 348 | +} | |
| 315 | 349 | |
| 316 | 350 | /* |
| 317 | 351 | ** WEBPAGE: help |
| 318 | 352 | ** URL: /help?name=CMD |
| 319 | 353 | ** |
| 320 | 354 |
| --- src/dispatch.c | |
| +++ src/dispatch.c | |
| @@ -310,10 +310,44 @@ | |
| 310 | }else{ |
| 311 | fossil_print("---\n"); |
| 312 | } |
| 313 | version_cmd(); |
| 314 | } |
| 315 | |
| 316 | /* |
| 317 | ** WEBPAGE: help |
| 318 | ** URL: /help?name=CMD |
| 319 | ** |
| 320 |
| --- src/dispatch.c | |
| +++ src/dispatch.c | |
| @@ -310,10 +310,44 @@ | |
| 310 | }else{ |
| 311 | fossil_print("---\n"); |
| 312 | } |
| 313 | version_cmd(); |
| 314 | } |
| 315 | |
| 316 | /* |
| 317 | ** Count the number of entries in the aCommand[] table that match |
| 318 | ** the given flag. |
| 319 | */ |
| 320 | static int countCmds(unsigned int eFlg){ |
| 321 | int n = 0; |
| 322 | int i; |
| 323 | for(i=0; i<MX_COMMAND; i++){ |
| 324 | if( (aCommand[i].eCmdFlags & eFlg)!=0 ) n++; |
| 325 | } |
| 326 | return n; |
| 327 | } |
| 328 | |
| 329 | /* |
| 330 | ** COMMAND: test-command-stats |
| 331 | ** |
| 332 | ** Print statistics about the built-in command dispatch table. |
| 333 | */ |
| 334 | void test_command_stats_cmd(void){ |
| 335 | fossil_print("commands: %4d\n", |
| 336 | countCmds( CMDFLAG_COMMAND )); |
| 337 | fossil_print(" 1st tier %4d\n", |
| 338 | countCmds( CMDFLAG_1ST_TIER )); |
| 339 | fossil_print(" 2nd tier %4d\n", |
| 340 | countCmds( CMDFLAG_2ND_TIER )); |
| 341 | fossil_print(" test %4d\n", |
| 342 | countCmds( CMDFLAG_TEST )); |
| 343 | fossil_print("web-pages: %4d\n", |
| 344 | countCmds( CMDFLAG_WEBPAGE )); |
| 345 | fossil_print("settings: %4d\n", |
| 346 | countCmds( CMDFLAG_SETTING )); |
| 347 | fossil_print("total entries: %4d\n", MX_COMMAND); |
| 348 | } |
| 349 | |
| 350 | /* |
| 351 | ** WEBPAGE: help |
| 352 | ** URL: /help?name=CMD |
| 353 | ** |
| 354 |