Fossil

Check-in [7d08c20fa5]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:merged improved stat page from trunk and slightly optimized style.c
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | wolfgangFormat2CSS
Files: files | file ages | folders
SHA1: 7d08c20fa56fd003c07211d1bd8d11104372f17b
User & Date: wolfgang 2010-09-11 13:11:43.000
Context
2010-09-11
16:14
'edit css' styled and made it pass HTML-Validator, optimized handling of additional styles in style.c ... (check-in: 286d4bcaa0 user: wolfgang tags: wolfgangFormat2CSS)
13:11
merged improved stat page from trunk and slightly optimized style.c ... (check-in: 7d08c20fa5 user: wolfgang tags: wolfgangFormat2CSS)
11:37
Improvements to the "stat" page formatting. ... (Closed-Leaf check-in: b41feab774 user: drh tags: trunk)
06:38
corrected % values in default styles(missing second %) ... (check-in: 7d88fac509 user: Ratte tags: wolfgangFormat2CSS)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/stat.c.
26
27
28
29
30
31
32

33

34
35
36
37
38
39
40
41
42
43
44
45
46
47
48

49

50





51
52
53
54
55
56
57
58
59
** WEBPAGE: stat
**
** Show statistics and global information about the repository.
*/
void stat_page(void){
  i64 t;
  int n, m, fsize;

  char zBuf[100];

  login_check_credentials();
  if( !g.okRead ){ login_needed(); return; }
  style_header("Repository Statistics");
  @ <p><table class="label-value">
  @ <tr><th>Repository&nbsp;Size:</th><td>
  fsize = file_size(g.zRepositoryName);
  @ %d(fsize) bytes
  @ </td></tr>
  @ <tr><th>Number&nbsp;Of&nbsp;Artifacts:</th><td>
  n = db_int(0, "SELECT count(*) FROM blob");
  m = db_int(0, "SELECT count(*) FROM delta");
  @ %d(n) (stored as %d(n-m) full text and %d(m) delta blobs)
  @ </td></tr>
  if( n>0 ){
    int a, b;

    @ <tr><th>Uncompressed&nbsp;Artifact&nbsp;Size:</th><td>

    t = db_int64(0, "SELECT total(size) FROM blob WHERE size>0");





    sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", t);
    @ %d((int)(((double)t)/(double)n)) bytes average, %s(zBuf) bytes total
    @ </td></tr>
    @ <tr><th>Compression&nbsp;Ratio:</th><td>
    if( t/fsize < 5 ){
      b = 10;
      fsize /= 10;
    }else{
      b = 1;







>

>















>

>
|
>
>
>
>
>

|







26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
** WEBPAGE: stat
**
** Show statistics and global information about the repository.
*/
void stat_page(void){
  i64 t;
  int n, m, fsize;
  int szMax, szAvg;
  char zBuf[100];
  char *zVers;
  login_check_credentials();
  if( !g.okRead ){ login_needed(); return; }
  style_header("Repository Statistics");
  @ <p><table class="label-value">
  @ <tr><th>Repository&nbsp;Size:</th><td>
  fsize = file_size(g.zRepositoryName);
  @ %d(fsize) bytes
  @ </td></tr>
  @ <tr><th>Number&nbsp;Of&nbsp;Artifacts:</th><td>
  n = db_int(0, "SELECT count(*) FROM blob");
  m = db_int(0, "SELECT count(*) FROM delta");
  @ %d(n) (stored as %d(n-m) full text and %d(m) delta blobs)
  @ </td></tr>
  if( n>0 ){
    int a, b;
    Stmt q;
    @ <tr><th>Uncompressed&nbsp;Artifact&nbsp;Size:</th><td>
    db_prepare(&q, "SELECT total(size), avg(size), max(size)"
                   " FROM blob WHERE size>0");
    db_step(&q);
    t = db_column_int64(&q, 0);
    szAvg = db_column_int(&q, 1);
    szMax = db_column_int(&q, 2);
    db_finalize(&q);
    sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", t);
    @ %d(szAvg) bytes average, %d(szMax) bytes max, %s(zBuf) bytes total
    @ </td></tr>
    @ <tr><th>Compression&nbsp;Ratio:</th><td>
    if( t/fsize < 5 ){
      b = 10;
      fsize /= 10;
    }else{
      b = 1;
80
81
82
83
84
85
86


87
88
89
90
91
92
93
94
95
96
97
98
99
100

101
102
103
104
105
106
107
108
109
110
111
112
                " WHERE +tagname GLOB 'tkt-*'");
  @ %d(n)
  @ </td></tr>
  @ <tr><th>Duration&nbsp;Of&nbsp;Project:</th><td>
  n = db_int(0, "SELECT julianday('now') - (SELECT min(mtime) FROM event)"
                " + 0.99");
  @ %d(n) days


  @ </td></tr>
  @ <tr><th>Project&nbsp;ID:</th><td>
  @ %h(db_get("project-code",""))
  @ </td></tr>
  @ <tr><th>Server&nbsp;ID:</th><td>
  @ %h(db_get("server-code",""))
  @ </td></tr>

  @ <tr><th>Fossil&nbsp;Version:</th><td>
  @ %h(MANIFEST_DATE) %h(MANIFEST_VERSION)
  @ </td></tr>
  @ <tr><th>SQLite&nbsp;Version:</th><td>
  @ %h(db_text(0, "SELECT substr(sqlite_source_id(),1,30)"))
  @ (%h(SQLITE_VERSION))

  @ </td></tr>
  @ <tr><th>Database&nbsp;Stats:</th><td>
  @ %d(db_int(0, "PRAGMA %s.page_count", g.zRepoDb)) pages,
  @ %d(db_int(0, "PRAGMA %s.page_size", g.zRepoDb)) bytes/page,
  @ %d(db_int(0, "PRAGMA %s.freelist_count", g.zRepoDb)) free pages,
  @ %s(db_text(0, "PRAGMA %s.encoding", g.zRepoDb)),
  @ %s(db_text(0, "PRAGMA %s.journal_mode", g.zRepoDb)) mode
  @ </td></tr>

  @ </table></p>
  style_footer();
}







>
>












|
|
>












89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
                " WHERE +tagname GLOB 'tkt-*'");
  @ %d(n)
  @ </td></tr>
  @ <tr><th>Duration&nbsp;Of&nbsp;Project:</th><td>
  n = db_int(0, "SELECT julianday('now') - (SELECT min(mtime) FROM event)"
                " + 0.99");
  @ %d(n) days
  sqlite3_snprintf(sizeof(zBuf), zBuf, "%.2f", n/365.24);
  @ or approximately %s(zBuf) years
  @ </td></tr>
  @ <tr><th>Project&nbsp;ID:</th><td>
  @ %h(db_get("project-code",""))
  @ </td></tr>
  @ <tr><th>Server&nbsp;ID:</th><td>
  @ %h(db_get("server-code",""))
  @ </td></tr>

  @ <tr><th>Fossil&nbsp;Version:</th><td>
  @ %h(MANIFEST_DATE) %h(MANIFEST_VERSION)
  @ </td></tr>
  @ <tr><th>SQLite&nbsp;Version:</th><td>
  sqlite3_snprintf(sizeof(zBuf), zBuf, "%.19s [%.10s] (%s)",
                   SQLITE_SOURCE_ID, &SQLITE_SOURCE_ID[20], SQLITE_VERSION);
  @ %s(zBuf)
  @ </td></tr>
  @ <tr><th>Database&nbsp;Stats:</th><td>
  @ %d(db_int(0, "PRAGMA %s.page_count", g.zRepoDb)) pages,
  @ %d(db_int(0, "PRAGMA %s.page_size", g.zRepoDb)) bytes/page,
  @ %d(db_int(0, "PRAGMA %s.freelist_count", g.zRepoDb)) free pages,
  @ %s(db_text(0, "PRAGMA %s.encoding", g.zRepoDb)),
  @ %s(db_text(0, "PRAGMA %s.journal_mode", g.zRepoDb)) mode
  @ </td></tr>

  @ </table></p>
  style_footer();
}
Changes to src/style.c.
137
138
139
140
141
142
143


144
145

146
147
148
149
150
151
152
    }
    @ </div>
  }
  @ <div class="content">
  cgi_destination(CGI_BODY);

  /* Put the footer at the bottom of the page.


  */
  @ </div><div style="clear: both;" />

  zFooter = db_get("footer", (char*)zDefaultFooter);
  if( g.thTrace ) Th_Trace("BEGIN_FOOTER<br />\n", -1);
  Th_Render(zFooter);
  if( g.thTrace ) Th_Trace("END_FOOTER<br />\n", -1);
  
  /* Render trace log if TH1 tracing is enabled. */
  if( g.thTrace ){







>
>

|
>







137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
    }
    @ </div>
  }
  @ <div class="content">
  cgi_destination(CGI_BODY);

  /* Put the footer at the bottom of the page.
  ** the additional clear/both is needed to extend the content
  ** part to the end of an optional sidebox.
  */
  @ <div style="clear: both;"></div>
  @ </div>
  zFooter = db_get("footer", (char*)zDefaultFooter);
  if( g.thTrace ) Th_Trace("BEGIN_FOOTER<br />\n", -1);
  Th_Render(zFooter);
  if( g.thTrace ) Th_Trace("END_FOOTER<br />\n", -1);
  
  /* Render trace log if TH1 tracing is enabled. */
  if( g.thTrace ){
388
389
390
391
392
393
394

395
396
397
398
399
400
401
@ }
@
;
const char zDivSidebox[] =
@ /* The nomenclature sidebox for branches,.. */
@ div.sidebox {
@   float: right;

@   border-width: medium;
@   border-style: double;
@   margin: 10;
@ }
@
;
const char zDivSideboxTitle[] =







>







391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
@ }
@
;
const char zDivSidebox[] =
@ /* The nomenclature sidebox for branches,.. */
@ div.sidebox {
@   float: right;
@   background-color: white;
@   border-width: medium;
@   border-style: double;
@   margin: 10;
@ }
@
;
const char zDivSideboxTitle[] =