/[gentoo-src]/gentoo-stats/general.php
Gentoo

Contents of /gentoo-stats/general.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Tue Apr 29 14:30:55 2003 UTC (11 years, 7 months ago) by mksoft
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +19 -24 lines
switched code generation to smarty templates

1 <?php
2 /**
3 * Gentoo stats
4 * Written by Meir Kriheli <mksoft@gentoo.org>
5 * Based on gentoo-stats by Maik Schreiber <blizzy@gentoo.org>
6 *
7 * $Id: general.php,v 1.1 2003/04/29 13:13:00 mksoft Exp $
8 *
9 * vim: set tabstop=4 shiftwidth=4:
10 */
11
12 require_once('stats.inc.php');
13
14 $smarty->assign('page_title','General Statistics');
15
16 $total_systems = getTotalUsers();
17 $updated_systems = getActiveUsers();
18
19 $updated_percent = 'N/A';
20 if ($total_systems > 0) {
21 $updated_percent = number_format($updated_systems * 100 / $total_systems,2);
22 }
23
24 $last_updated = getLastSystemUpdate();
25 $total_cpus = getTotalCPUs();
26
27 $avg_cpus = 'N/A';
28 if ($updated_systems > 0) {
29 $avg_cpus = number_format($total_cpus / $updated_systems,4);
30 }
31
32 $cpu_stats = getCPUStats();
33 if (is_array($cpu_stats)) {
34 list($max_mhz,$min_mhz,$avg_mhz) = $cpu_stats;
35 $max_mhz = number_format($max_mhz/10000,2) . ' MHz';
36 $min_mhz = number_format($min_mhz/10000,2) . ' MHz';
37 $avg_mhz = number_format($avg_mhz/10000,2) . ' MHz';
38 }
39 else {
40 $max_mhz=$min_mhz=$avg_mhz='N/A';
41 }
42
43 $smarty->assign('total_systems',number_format($total_systems));
44 $smarty->assign('updated_systems',number_format($updated_systems));
45 $smarty->assign('updated_percent',$updated_percent);
46 $smarty->assign('last_updated',$last_updated);
47 $smarty->assign('total_cpus',number_format($total_cpus));
48 $smarty->assign('avg_cpus',$avg_cpus);
49 $smarty->assign('avg_mhz',$avg_mhz);
50 $smarty->assign('min_mhz',$min_mhz);
51 $smarty->assign('max_mhz',$max_mhz);
52
53 $smarty->display('general.tpl');
54
55 ?>

  ViewVC Help
Powered by ViewVC 1.1.20