/* ** Copyright (c) 2007 D. Richard Hipp ** ** This program is free software; you can redistribute it and/or ** modify it under the terms of the GNU General Public ** License version 2 as published by the Free Software Foundation. ** ** 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. See the GNU ** General Public License for more details. ** ** You should have received a copy of the GNU General Public ** License along with this library; if not, write to the ** Free Software Foundation, Inc., 59 Temple Place - Suite 330, ** Boston, MA 02111-1307, USA. ** ** 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-m) complete, %d(m) deltas, %d(n) total @
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 Baselines: 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(); }