Fossil SCM

merged improved stat page from trunk and slightly optimized style.c

wolfgang 2010-09-11 13:11 wolfgangFormat2CSS merge
Commit 7d08c20fa56fd003c07211d1bd8d11104372f17b
3 files changed +16 -4 +5 -1 +5 -1
+16 -4
--- src/stat.c
+++ src/stat.c
@@ -28,11 +28,13 @@
2828
** Show statistics and global information about the repository.
2929
*/
3030
void stat_page(void){
3131
i64 t;
3232
int n, m, fsize;
33
+ int szMax, szAvg;
3334
char zBuf[100];
35
+ char *zVers;
3436
login_check_credentials();
3537
if( !g.okRead ){ login_needed(); return; }
3638
style_header("Repository Statistics");
3739
@ <p><table class="label-value">
3840
@ <tr><th>Repository&nbsp;Size:</th><td>
@@ -44,14 +46,21 @@
4446
m = db_int(0, "SELECT count(*) FROM delta");
4547
@ %d(n) (stored as %d(n-m) full text and %d(m) delta blobs)
4648
@ </td></tr>
4749
if( n>0 ){
4850
int a, b;
51
+ Stmt q;
4952
@ <tr><th>Uncompressed&nbsp;Artifact&nbsp;Size:</th><td>
50
- t = db_int64(0, "SELECT total(size) FROM blob WHERE size>0");
53
+ db_prepare(&q, "SELECT total(size), avg(size), max(size)"
54
+ " FROM blob WHERE size>0");
55
+ db_step(&q);
56
+ t = db_column_int64(&q, 0);
57
+ szAvg = db_column_int(&q, 1);
58
+ szMax = db_column_int(&q, 2);
59
+ db_finalize(&q);
5160
sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", t);
52
- @ %d((int)(((double)t)/(double)n)) bytes average, %s(zBuf) bytes total
61
+ @ %d(szAvg) bytes average, %d(szMax) bytes max, %s(zBuf) bytes total
5362
@ </td></tr>
5463
@ <tr><th>Compression&nbsp;Ratio:</th><td>
5564
if( t/fsize < 5 ){
5665
b = 10;
5766
fsize /= 10;
@@ -82,10 +91,12 @@
8291
@ </td></tr>
8392
@ <tr><th>Duration&nbsp;Of&nbsp;Project:</th><td>
8493
n = db_int(0, "SELECT julianday('now') - (SELECT min(mtime) FROM event)"
8594
" + 0.99");
8695
@ %d(n) days
96
+ sqlite3_snprintf(sizeof(zBuf), zBuf, "%.2f", n/365.24);
97
+ @ or approximately %s(zBuf) years
8798
@ </td></tr>
8899
@ <tr><th>Project&nbsp;ID:</th><td>
89100
@ %h(db_get("project-code",""))
90101
@ </td></tr>
91102
@ <tr><th>Server&nbsp;ID:</th><td>
@@ -94,12 +105,13 @@
94105
95106
@ <tr><th>Fossil&nbsp;Version:</th><td>
96107
@ %h(MANIFEST_DATE) %h(MANIFEST_VERSION)
97108
@ </td></tr>
98109
@ <tr><th>SQLite&nbsp;Version:</th><td>
99
- @ %h(db_text(0, "SELECT substr(sqlite_source_id(),1,30)"))
100
- @ (%h(SQLITE_VERSION))
110
+ sqlite3_snprintf(sizeof(zBuf), zBuf, "%.19s [%.10s] (%s)",
111
+ SQLITE_SOURCE_ID, &SQLITE_SOURCE_ID[20], SQLITE_VERSION);
112
+ @ %s(zBuf)
101113
@ </td></tr>
102114
@ <tr><th>Database&nbsp;Stats:</th><td>
103115
@ %d(db_int(0, "PRAGMA %s.page_count", g.zRepoDb)) pages,
104116
@ %d(db_int(0, "PRAGMA %s.page_size", g.zRepoDb)) bytes/page,
105117
@ %d(db_int(0, "PRAGMA %s.freelist_count", g.zRepoDb)) free pages,
106118
--- src/stat.c
+++ src/stat.c
@@ -28,11 +28,13 @@
28 ** Show statistics and global information about the repository.
29 */
30 void stat_page(void){
31 i64 t;
32 int n, m, fsize;
 
33 char zBuf[100];
 
34 login_check_credentials();
35 if( !g.okRead ){ login_needed(); return; }
36 style_header("Repository Statistics");
37 @ <p><table class="label-value">
38 @ <tr><th>Repository&nbsp;Size:</th><td>
@@ -44,14 +46,21 @@
44 m = db_int(0, "SELECT count(*) FROM delta");
45 @ %d(n) (stored as %d(n-m) full text and %d(m) delta blobs)
46 @ </td></tr>
47 if( n>0 ){
48 int a, b;
 
49 @ <tr><th>Uncompressed&nbsp;Artifact&nbsp;Size:</th><td>
50 t = db_int64(0, "SELECT total(size) FROM blob WHERE size>0");
 
 
 
 
 
 
51 sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", t);
52 @ %d((int)(((double)t)/(double)n)) bytes average, %s(zBuf) bytes total
53 @ </td></tr>
54 @ <tr><th>Compression&nbsp;Ratio:</th><td>
55 if( t/fsize < 5 ){
56 b = 10;
57 fsize /= 10;
@@ -82,10 +91,12 @@
82 @ </td></tr>
83 @ <tr><th>Duration&nbsp;Of&nbsp;Project:</th><td>
84 n = db_int(0, "SELECT julianday('now') - (SELECT min(mtime) FROM event)"
85 " + 0.99");
86 @ %d(n) days
 
 
87 @ </td></tr>
88 @ <tr><th>Project&nbsp;ID:</th><td>
89 @ %h(db_get("project-code",""))
90 @ </td></tr>
91 @ <tr><th>Server&nbsp;ID:</th><td>
@@ -94,12 +105,13 @@
94
95 @ <tr><th>Fossil&nbsp;Version:</th><td>
96 @ %h(MANIFEST_DATE) %h(MANIFEST_VERSION)
97 @ </td></tr>
98 @ <tr><th>SQLite&nbsp;Version:</th><td>
99 @ %h(db_text(0, "SELECT substr(sqlite_source_id(),1,30)"))
100 @ (%h(SQLITE_VERSION))
 
101 @ </td></tr>
102 @ <tr><th>Database&nbsp;Stats:</th><td>
103 @ %d(db_int(0, "PRAGMA %s.page_count", g.zRepoDb)) pages,
104 @ %d(db_int(0, "PRAGMA %s.page_size", g.zRepoDb)) bytes/page,
105 @ %d(db_int(0, "PRAGMA %s.freelist_count", g.zRepoDb)) free pages,
106
--- src/stat.c
+++ src/stat.c
@@ -28,11 +28,13 @@
28 ** Show statistics and global information about the repository.
29 */
30 void stat_page(void){
31 i64 t;
32 int n, m, fsize;
33 int szMax, szAvg;
34 char zBuf[100];
35 char *zVers;
36 login_check_credentials();
37 if( !g.okRead ){ login_needed(); return; }
38 style_header("Repository Statistics");
39 @ <p><table class="label-value">
40 @ <tr><th>Repository&nbsp;Size:</th><td>
@@ -44,14 +46,21 @@
46 m = db_int(0, "SELECT count(*) FROM delta");
47 @ %d(n) (stored as %d(n-m) full text and %d(m) delta blobs)
48 @ </td></tr>
49 if( n>0 ){
50 int a, b;
51 Stmt q;
52 @ <tr><th>Uncompressed&nbsp;Artifact&nbsp;Size:</th><td>
53 db_prepare(&q, "SELECT total(size), avg(size), max(size)"
54 " FROM blob WHERE size>0");
55 db_step(&q);
56 t = db_column_int64(&q, 0);
57 szAvg = db_column_int(&q, 1);
58 szMax = db_column_int(&q, 2);
59 db_finalize(&q);
60 sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", t);
61 @ %d(szAvg) bytes average, %d(szMax) bytes max, %s(zBuf) bytes total
62 @ </td></tr>
63 @ <tr><th>Compression&nbsp;Ratio:</th><td>
64 if( t/fsize < 5 ){
65 b = 10;
66 fsize /= 10;
@@ -82,10 +91,12 @@
91 @ </td></tr>
92 @ <tr><th>Duration&nbsp;Of&nbsp;Project:</th><td>
93 n = db_int(0, "SELECT julianday('now') - (SELECT min(mtime) FROM event)"
94 " + 0.99");
95 @ %d(n) days
96 sqlite3_snprintf(sizeof(zBuf), zBuf, "%.2f", n/365.24);
97 @ or approximately %s(zBuf) years
98 @ </td></tr>
99 @ <tr><th>Project&nbsp;ID:</th><td>
100 @ %h(db_get("project-code",""))
101 @ </td></tr>
102 @ <tr><th>Server&nbsp;ID:</th><td>
@@ -94,12 +105,13 @@
105
106 @ <tr><th>Fossil&nbsp;Version:</th><td>
107 @ %h(MANIFEST_DATE) %h(MANIFEST_VERSION)
108 @ </td></tr>
109 @ <tr><th>SQLite&nbsp;Version:</th><td>
110 sqlite3_snprintf(sizeof(zBuf), zBuf, "%.19s [%.10s] (%s)",
111 SQLITE_SOURCE_ID, &SQLITE_SOURCE_ID[20], SQLITE_VERSION);
112 @ %s(zBuf)
113 @ </td></tr>
114 @ <tr><th>Database&nbsp;Stats:</th><td>
115 @ %d(db_int(0, "PRAGMA %s.page_count", g.zRepoDb)) pages,
116 @ %d(db_int(0, "PRAGMA %s.page_size", g.zRepoDb)) bytes/page,
117 @ %d(db_int(0, "PRAGMA %s.freelist_count", g.zRepoDb)) free pages,
118
+5 -1
--- src/style.c
+++ src/style.c
@@ -139,12 +139,15 @@
139139
}
140140
@ <div class="content">
141141
cgi_destination(CGI_BODY);
142142
143143
/* Put the footer at the bottom of the page.
144
+ ** the additional clear/both is needed to extend the content
145
+ ** part to the end of an optional sidebox.
144146
*/
145
- @ </div><div style="clear: both;" />
147
+ @ <div style="clear: both;"></div>
148
+ @ </div>
146149
zFooter = db_get("footer", (char*)zDefaultFooter);
147150
if( g.thTrace ) Th_Trace("BEGIN_FOOTER<br />\n", -1);
148151
Th_Render(zFooter);
149152
if( g.thTrace ) Th_Trace("END_FOOTER<br />\n", -1);
150153
@@ -390,10 +393,11 @@
390393
;
391394
const char zDivSidebox[] =
392395
@ /* The nomenclature sidebox for branches,.. */
393396
@ div.sidebox {
394397
@ float: right;
398
+@ background-color: white;
395399
@ border-width: medium;
396400
@ border-style: double;
397401
@ margin: 10;
398402
@ }
399403
@
400404
--- src/style.c
+++ src/style.c
@@ -139,12 +139,15 @@
139 }
140 @ <div class="content">
141 cgi_destination(CGI_BODY);
142
143 /* Put the footer at the bottom of the page.
 
 
144 */
145 @ </div><div style="clear: both;" />
 
146 zFooter = db_get("footer", (char*)zDefaultFooter);
147 if( g.thTrace ) Th_Trace("BEGIN_FOOTER<br />\n", -1);
148 Th_Render(zFooter);
149 if( g.thTrace ) Th_Trace("END_FOOTER<br />\n", -1);
150
@@ -390,10 +393,11 @@
390 ;
391 const char zDivSidebox[] =
392 @ /* The nomenclature sidebox for branches,.. */
393 @ div.sidebox {
394 @ float: right;
 
395 @ border-width: medium;
396 @ border-style: double;
397 @ margin: 10;
398 @ }
399 @
400
--- src/style.c
+++ src/style.c
@@ -139,12 +139,15 @@
139 }
140 @ <div class="content">
141 cgi_destination(CGI_BODY);
142
143 /* Put the footer at the bottom of the page.
144 ** the additional clear/both is needed to extend the content
145 ** part to the end of an optional sidebox.
146 */
147 @ <div style="clear: both;"></div>
148 @ </div>
149 zFooter = db_get("footer", (char*)zDefaultFooter);
150 if( g.thTrace ) Th_Trace("BEGIN_FOOTER<br />\n", -1);
151 Th_Render(zFooter);
152 if( g.thTrace ) Th_Trace("END_FOOTER<br />\n", -1);
153
@@ -390,10 +393,11 @@
393 ;
394 const char zDivSidebox[] =
395 @ /* The nomenclature sidebox for branches,.. */
396 @ div.sidebox {
397 @ float: right;
398 @ background-color: white;
399 @ border-width: medium;
400 @ border-style: double;
401 @ margin: 10;
402 @ }
403 @
404
+5 -1
--- src/style.c
+++ src/style.c
@@ -139,12 +139,15 @@
139139
}
140140
@ <div class="content">
141141
cgi_destination(CGI_BODY);
142142
143143
/* Put the footer at the bottom of the page.
144
+ ** the additional clear/both is needed to extend the content
145
+ ** part to the end of an optional sidebox.
144146
*/
145
- @ </div><div style="clear: both;" />
147
+ @ <div style="clear: both;"></div>
148
+ @ </div>
146149
zFooter = db_get("footer", (char*)zDefaultFooter);
147150
if( g.thTrace ) Th_Trace("BEGIN_FOOTER<br />\n", -1);
148151
Th_Render(zFooter);
149152
if( g.thTrace ) Th_Trace("END_FOOTER<br />\n", -1);
150153
@@ -390,10 +393,11 @@
390393
;
391394
const char zDivSidebox[] =
392395
@ /* The nomenclature sidebox for branches,.. */
393396
@ div.sidebox {
394397
@ float: right;
398
+@ background-color: white;
395399
@ border-width: medium;
396400
@ border-style: double;
397401
@ margin: 10;
398402
@ }
399403
@
400404
--- src/style.c
+++ src/style.c
@@ -139,12 +139,15 @@
139 }
140 @ <div class="content">
141 cgi_destination(CGI_BODY);
142
143 /* Put the footer at the bottom of the page.
 
 
144 */
145 @ </div><div style="clear: both;" />
 
146 zFooter = db_get("footer", (char*)zDefaultFooter);
147 if( g.thTrace ) Th_Trace("BEGIN_FOOTER<br />\n", -1);
148 Th_Render(zFooter);
149 if( g.thTrace ) Th_Trace("END_FOOTER<br />\n", -1);
150
@@ -390,10 +393,11 @@
390 ;
391 const char zDivSidebox[] =
392 @ /* The nomenclature sidebox for branches,.. */
393 @ div.sidebox {
394 @ float: right;
 
395 @ border-width: medium;
396 @ border-style: double;
397 @ margin: 10;
398 @ }
399 @
400
--- src/style.c
+++ src/style.c
@@ -139,12 +139,15 @@
139 }
140 @ <div class="content">
141 cgi_destination(CGI_BODY);
142
143 /* Put the footer at the bottom of the page.
144 ** the additional clear/both is needed to extend the content
145 ** part to the end of an optional sidebox.
146 */
147 @ <div style="clear: both;"></div>
148 @ </div>
149 zFooter = db_get("footer", (char*)zDefaultFooter);
150 if( g.thTrace ) Th_Trace("BEGIN_FOOTER<br />\n", -1);
151 Th_Render(zFooter);
152 if( g.thTrace ) Th_Trace("END_FOOTER<br />\n", -1);
153
@@ -390,10 +393,11 @@
393 ;
394 const char zDivSidebox[] =
395 @ /* The nomenclature sidebox for branches,.. */
396 @ div.sidebox {
397 @ float: right;
398 @ background-color: white;
399 @ border-width: medium;
400 @ border-style: double;
401 @ margin: 10;
402 @ }
403 @
404

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button