Fossil SCM

Fix problems on the stat page that appear for larger repositories.

drh 2008-03-06 00:26 trunk
Commit 80dc46d635bc236ca792ac2ad11da02c42d6ceec
2 files changed +2 +6 -3
--- src/setup.c
+++ src/setup.c
@@ -74,10 +74,12 @@
7474
"Edit the Cascading Style Sheet used by all pages of this repository");
7575
setup_menu_entry("Header", "setup_header",
7676
"Edit HTML text inserted at the top of every page");
7777
setup_menu_entry("Footer", "setup_footer",
7878
"Edit HTML text inserted at the bottom of every page");
79
+ setup_menu_entry("Stats", "stat",
80
+ "Display repository statistics");
7981
@ </table>
8082
8183
style_footer();
8284
}
8385
8486
--- src/setup.c
+++ src/setup.c
@@ -74,10 +74,12 @@
74 "Edit the Cascading Style Sheet used by all pages of this repository");
75 setup_menu_entry("Header", "setup_header",
76 "Edit HTML text inserted at the top of every page");
77 setup_menu_entry("Footer", "setup_footer",
78 "Edit HTML text inserted at the bottom of every page");
 
 
79 @ </table>
80
81 style_footer();
82 }
83
84
--- src/setup.c
+++ src/setup.c
@@ -74,10 +74,12 @@
74 "Edit the Cascading Style Sheet used by all pages of this repository");
75 setup_menu_entry("Header", "setup_header",
76 "Edit HTML text inserted at the top of every page");
77 setup_menu_entry("Footer", "setup_footer",
78 "Edit HTML text inserted at the bottom of every page");
79 setup_menu_entry("Stats", "stat",
80 "Display repository statistics");
81 @ </table>
82
83 style_footer();
84 }
85
86
+6 -3
--- src/stat.c
+++ src/stat.c
@@ -32,11 +32,13 @@
3232
** WEBPAGE: stat
3333
**
3434
** Show statistics and global information about the repository.
3535
*/
3636
void stat_page(void){
37
- int n, m, k;
37
+ i64 t;
38
+ int n, m;
39
+ char zBuf[100];
3840
login_check_credentials();
3941
if( !g.okRead ){ login_needed(); return; }
4042
style_header("Repository Statistics");
4143
@ <p><table class="label-value">
4244
@ <tr><th>Repository&nbsp;Size:</th><td>
@@ -48,12 +50,13 @@
4850
m = db_int(0, "SELECT count(*) FROM delta");
4951
@ %d(n-m) complete, %d(m) deltas, %d(n) total
5052
@ </td></tr>
5153
if( n>0 ){
5254
@ <tr><th>Uncompressed&nbsp;Artifact&nbsp;Size:</th><td>
53
- k = db_int(0, "SELECT total(size) FROM blob WHERE size>0");
54
- @ %d((int)(((double)k)/(double)n)) bytes average, %d(k) bytes total
55
+ t = db_int64(0, "SELECT total(size) FROM blob WHERE size>0");
56
+ sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", t);
57
+ @ %d((int)(((double)t)/(double)n)) bytes average, %s(zBuf) bytes total
5558
@ </td></tr>
5659
}
5760
@ <tr><th>Number&nbsp;Of&nbsp;Baselines:</th><td>
5861
n = db_int(0, "SELECT count(distinct mid) FROM mlink");
5962
@ %d(n)
6063
--- src/stat.c
+++ src/stat.c
@@ -32,11 +32,13 @@
32 ** WEBPAGE: stat
33 **
34 ** Show statistics and global information about the repository.
35 */
36 void stat_page(void){
37 int n, m, k;
 
 
38 login_check_credentials();
39 if( !g.okRead ){ login_needed(); return; }
40 style_header("Repository Statistics");
41 @ <p><table class="label-value">
42 @ <tr><th>Repository&nbsp;Size:</th><td>
@@ -48,12 +50,13 @@
48 m = db_int(0, "SELECT count(*) FROM delta");
49 @ %d(n-m) complete, %d(m) deltas, %d(n) total
50 @ </td></tr>
51 if( n>0 ){
52 @ <tr><th>Uncompressed&nbsp;Artifact&nbsp;Size:</th><td>
53 k = db_int(0, "SELECT total(size) FROM blob WHERE size>0");
54 @ %d((int)(((double)k)/(double)n)) bytes average, %d(k) bytes total
 
55 @ </td></tr>
56 }
57 @ <tr><th>Number&nbsp;Of&nbsp;Baselines:</th><td>
58 n = db_int(0, "SELECT count(distinct mid) FROM mlink");
59 @ %d(n)
60
--- src/stat.c
+++ src/stat.c
@@ -32,11 +32,13 @@
32 ** WEBPAGE: stat
33 **
34 ** Show statistics and global information about the repository.
35 */
36 void stat_page(void){
37 i64 t;
38 int n, m;
39 char zBuf[100];
40 login_check_credentials();
41 if( !g.okRead ){ login_needed(); return; }
42 style_header("Repository Statistics");
43 @ <p><table class="label-value">
44 @ <tr><th>Repository&nbsp;Size:</th><td>
@@ -48,12 +50,13 @@
50 m = db_int(0, "SELECT count(*) FROM delta");
51 @ %d(n-m) complete, %d(m) deltas, %d(n) total
52 @ </td></tr>
53 if( n>0 ){
54 @ <tr><th>Uncompressed&nbsp;Artifact&nbsp;Size:</th><td>
55 t = db_int64(0, "SELECT total(size) FROM blob WHERE size>0");
56 sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", t);
57 @ %d((int)(((double)t)/(double)n)) bytes average, %s(zBuf) bytes total
58 @ </td></tr>
59 }
60 @ <tr><th>Number&nbsp;Of&nbsp;Baselines:</th><td>
61 n = db_int(0, "SELECT count(distinct mid) FROM mlink");
62 @ %d(n)
63

Keyboard Shortcuts

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