/* ** Copyright (c) 2007 D. Richard Hipp ** ** This program is free software; you can redistribute it and/or ** modify it under the terms of the Simplified BSD License (also ** known as the "2-Clause License" or "FreeBSD License".) ** This program is distributed in the hope that it will be useful, ** but without any warranty; without even the implied warranty of ** merchantability or fitness for a particular purpose. ** ** Author contact information: ** drh@hwaci.com ** http://www.hwaci.com/drh/ ** ******************************************************************************* ** ** This file contains code to implement the stat web page ** */ #include #include "config.h" #include "stat.h" /* ** 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"); @

@ @ if( n>0 ){ int a, b; @ @ } @ @ @ @ @ @ @ @
Repository Size: fsize = file_size(g.zRepositoryName); @ %d(fsize) bytes @
Number Of Artifacts: 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) @
Uncompressed Artifact Size: 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 @
Compression Ratio: if( t/fsize < 5 ){ b = 10; fsize /= 10; }else{ b = 1; } a = t/fsize; @ %d(a):%d(b) @
Number Of Check-ins: n = db_int(0, "SELECT count(distinct mid) FROM mlink"); @ %d(n) @
Number Of Files: n = db_int(0, "SELECT count(*) FROM filename"); @ %d(n) @
Number Of Wiki Pages: n = db_int(0, "SELECT count(*) FROM tag WHERE +tagname GLOB 'wiki-*'"); @ %d(n) @
Number Of Tickets: n = db_int(0, "SELECT count(*) FROM tag WHERE +tagname GLOB 'tkt-*'"); @ %d(n) @
Duration Of Project: n = db_int(0, "SELECT julianday('now') - (SELECT min(mtime) FROM event) + 0.99"); @ %d(n) days @
Project ID: @ %h(db_get("project-code","")) @
Server ID: @ %h(db_get("server-code","")) @

style_footer(); }