| | @@ -500,10 +500,11 @@ |
| 500 | 500 | ** --noverify Skip the verification of changes to the BLOB table |
| 501 | 501 | ** --pagesize N Set the database pagesize to N. (512..65536 and power of 2) |
| 502 | 502 | ** --randomize Scan artifacts in a random order |
| 503 | 503 | ** --vacuum Run VACUUM on the database after rebuilding |
| 504 | 504 | ** --wal Set Write-Ahead-Log journalling mode on the database |
| 505 | +** --stats Show artifact statistics after rebuilding |
| 505 | 506 | ** |
| 506 | 507 | ** See also: deconstruct, reconstruct |
| 507 | 508 | */ |
| 508 | 509 | void rebuild_database(void){ |
| 509 | 510 | int forceFlag; |
| | @@ -514,18 +515,20 @@ |
| 514 | 515 | const char *zPagesize; |
| 515 | 516 | int newPagesize = 0; |
| 516 | 517 | int activateWal; |
| 517 | 518 | int runVacuum; |
| 518 | 519 | int runCompress; |
| 520 | + int showStats; |
| 519 | 521 | |
| 520 | 522 | omitVerify = find_option("noverify",0,0)!=0; |
| 521 | 523 | forceFlag = find_option("force","f",0)!=0; |
| 522 | 524 | randomizeFlag = find_option("randomize", 0, 0)!=0; |
| 523 | 525 | doClustering = find_option("cluster", 0, 0)!=0; |
| 524 | 526 | runVacuum = find_option("vacuum",0,0)!=0; |
| 525 | 527 | runCompress = find_option("compress",0,0)!=0; |
| 526 | 528 | zPagesize = find_option("pagesize",0,1); |
| 529 | + showStats = find_option("stats",0,0)!=0; |
| 527 | 530 | if( zPagesize ){ |
| 528 | 531 | newPagesize = atoi(zPagesize); |
| 529 | 532 | if( newPagesize<512 || newPagesize>65536 |
| 530 | 533 | || (newPagesize&(newPagesize-1))!=0 |
| 531 | 534 | ){ |
| | @@ -579,10 +582,30 @@ |
| 579 | 582 | } |
| 580 | 583 | if( activateWal ){ |
| 581 | 584 | db_multi_exec("PRAGMA journal_mode=WAL;"); |
| 582 | 585 | } |
| 583 | 586 | } |
| 587 | + if( showStats ){ |
| 588 | + static struct { int idx; const char *zLabel; } aStat[] = { |
| 589 | + { CFTYPE_ANY, "Artifacts:" }, |
| 590 | + { CFTYPE_MANIFEST, "Manifests:" }, |
| 591 | + { CFTYPE_CLUSTER, "Clusters:" }, |
| 592 | + { CFTYPE_CONTROL, "Tags:" }, |
| 593 | + { CFTYPE_WIKI, "Wikis:" }, |
| 594 | + { CFTYPE_TICKET, "Tickets:" }, |
| 595 | + { CFTYPE_ATTACHMENT,"Attachments:" }, |
| 596 | + { CFTYPE_EVENT, "Events:" }, |
| 597 | + }; |
| 598 | + int i; |
| 599 | + int subtotal = 0; |
| 600 | + for(i=0; i<count(aStat); i++){ |
| 601 | + int k = aStat[i].idx; |
| 602 | + fossil_print("%-15s %6d\n", aStat[i].zLabel, g.parseCnt[k]); |
| 603 | + if( k>0 ) subtotal += g.parseCnt[k]; |
| 604 | + } |
| 605 | + fossil_print("%-15s %6d\n", "Other:", g.parseCnt[CFTYPE_ANY] - subtotal); |
| 606 | + } |
| 584 | 607 | } |
| 585 | 608 | |
| 586 | 609 | /* |
| 587 | 610 | ** COMMAND: test-detach ?REPOSITORY? |
| 588 | 611 | ** |
| 589 | 612 | |