Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Rough prototype for the /artifact_stats page. Still many issues. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | artifact-stats |
Files: | files | file ages | folders |
SHA3-256: |
dd1c8fb3ea5a8bebfc37acfa56542e3e |
User & Date: | drh 2017-12-09 17:49:50.667 |
Context
2017-12-09
| ||
22:00 | Fixes to the /artifact_stats page. Make it Admin-only. ... (Closed-Leaf check-in: 2d916a5e user: drh tags: artifact-stats) | |
17:49 | Rough prototype for the /artifact_stats page. Still many issues. ... (check-in: dd1c8fb3 user: drh tags: artifact-stats) | |
02:47 | The graph arrowhead control was inverted due to a missing "!" character in the graph.js file. ... (check-in: 561fa8a3 user: drh tags: trunk) | |
Changes
Changes to src/stat.c.
︙ | ︙ | |||
567 568 569 570 571 572 573 | @ <h2>%h(file_tail(g.zLocalDbName)) Size: %s(zBuf)</h2> @ <center><svg width='800' height='500'> piechart_render(800,500,PIE_OTHER|PIE_PERCENT); @ </svg></center> } style_footer(); } | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 | @ <h2>%h(file_tail(g.zLocalDbName)) Size: %s(zBuf)</h2> @ <center><svg width='800' height='500'> piechart_render(800,500,PIE_OTHER|PIE_PERCENT); @ </svg></center> } style_footer(); } /* ** Gather statistics on artifact types, counts, and sizes. */ static void gather_artifact_stats(void){ static const char zSql[] = @ CREATE TEMP TABLE artstat( @ id INTEGER PRIMARY KEY, -- Corresponds to BLOB.RID @ atype TEXT, -- 'data', 'manifest', 'tag', 'wiki', etc. @ isDelta BOOLEAN, -- true if stored as a delta @ szExp, -- expanded, uncompressed size @ szCmpr -- size as stored on disk @ ); @ INSERT INTO artstat(id,atype,isDelta,szExp,szCmpr) @ SELECT blob.rid, @ (SELECT type FROM description WHERE description.rid=blob.rid), @ EXISTS(SELECT 1 FROM delta WHERE delta.rid=blob.rid), @ size, length(content) @ FROM blob WHERE content IS NOT NULL; ; describe_artifacts("IS NOT NULL"); db_multi_exec("%s", zSql/*safe-for-%s*/); } /* ** WEBPAGE: artifact_stats ** ** Show information about the sizes of artifacts in this repository */ void artifact_stats_page(void){ Stmt q; login_check_credentials(); if( !g.perm.Read ){ login_needed(g.anon.Read); return; } style_header("Artifact Statistics"); gather_artifact_stats(); db_prepare(&q, "SELECT atype, count(*), sum(isDelta), sum(szCmpr), sum(szExp)" " FROM artstat GROUP BY 1" " UNION ALL " "SELECT 'TOTAL', count(*), sum(isDelta), sum(szCmpr), sum(szExp)" " FROM artstat;" ); @ <table class='sortable' border='1'\ @ data-column-types='tkkkkk' data-init-sort='0'> @ <thead><tr> @ <th>Artifact Type</th> @ <th>Count</th> @ <th>Full-Text</th> @ <th>Delta</th> @ <th>Compressed Size</th> @ <th>Uncompressed Size</th> @ </tr></thead><tbody> while( db_step(&q)==SQLITE_ROW ){ const char *zType = db_column_text(&q, 0); int nTotal = db_column_int(&q, 1); int nDelta = db_column_int(&q, 2); int nFull = nTotal - nTotal; sqlite3_int64 szCmpr = db_column_int64(&q, 3); sqlite3_int64 szExp = db_column_int64(&q, 4); char *z; @ <tr><td>%h(zType)</td> z = sqlite3_mprintf("%,d", nTotal); @ <td data-sortkey='%08x(nTotal)' align='right'>%s(z)</td> sqlite3_free(z); z = sqlite3_mprintf("%,d", nDelta); @ <td data-sortkey='%08x(nDelta)' align='right'>%s(z)</td> sqlite3_free(z); z = sqlite3_mprintf("%,d", nFull); @ <td data-sortkey='%08x(nFull)' align='right'>%s(z)</td> sqlite3_free(z); z = sqlite3_mprintf("%,lld", szCmpr); @ <td data-sortkey='%016x(szCmpr)' align='right'>%s(z)</td> sqlite3_free(z); z = sqlite3_mprintf("%,lld", szExp); @ <td data-sortkey='%016x(szExp)' align='right'>%s(z)</td> sqlite3_free(z); } @ </tbody></table></div> db_finalize(&q); style_table_sorter(); style_footer(); } |