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

Diff of /gentoo-stats/cpus.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.1 Revision 1.2
2/** 2/**
3 * Gentoo stats 3 * Gentoo stats
4 * Written by Meir Kriheli <mksoft@gentoo.org> 4 * Written by Meir Kriheli <mksoft@gentoo.org>
5 * Based on gentoo-stats by Maik Schreiber <blizzy@gentoo.org> 5 * Based on gentoo-stats by Maik Schreiber <blizzy@gentoo.org>
6 * 6 *
7 * $Id: cpus.php,v 1.1 2003/04/29 23:00:41 mksoft Exp $ 7 * $Id: cpus.php,v 1.2 2003/05/09 10:01:08 mksoft Exp $
8 * 8 *
9 * vim: set tabstop=4 shiftwidth=4: 9 * vim: set tabstop=4 shiftwidth=4:
10 */ 10 */
11 11
12require_once('stats.inc.php'); 12require_once('stats.inc.php');
32 $cpu_vendors[$i]['bar_width'] = (int)($count * $bar_width/$total_cpus); 32 $cpu_vendors[$i]['bar_width'] = (int)($count * $bar_width/$total_cpus);
33 $cpu_vendors[$i]['bar_empty_width'] = $bar_width - $cpu_vendors[$i]['bar_width']; 33 $cpu_vendors[$i]['bar_empty_width'] = $bar_width - $cpu_vendors[$i]['bar_width'];
34 } 34 }
35 $smarty->assign('cpu_vendors',$cpu_vendors); 35 $smarty->assign('cpu_vendors',$cpu_vendors);
36 } 36 }
37
38 $sql = "SELECT count(cm.cm_id) as cm_count, cm.cm_name " .
39 "FROM t_cpu_modelnames cm, t_users2cpus uc, t_users u " .
40 "WHERE (cm.cm_id = uc.cv_id) AND (u.u_id = uc.u_id) " .
41 "AND (u_last_update IS NOT NULL) " .
42 "AND (TO_DAYS(NOW()) - TO_DAYS(u_last_update) <= $active_days) " .
43 "GROUP BY cm.cm_id " .
44 "ORDER BY cm.cm_name ";
45 $cpu_models = $db->getAll($sql,DB_FETCHMODE_ASSOC);
46
47 if (!DB::isError($cpu_models)) {
48 for ($i=0;$i<count($cpu_vendors);$i++) {
49 $count = $cpu_models[$i]['cm_count'];
50 $cpu_models[$i]['cm_name'] = htmlspecialchars($cpu_models[$i]['cm_name']);
51 $cpu_models[$i]['cm_count'] = number_format($count);
52 $cpu_models[$i]['cm_percent'] = number_format($count * 100 / $total_cpus,3);
53 $cpu_models[$i]['bar_width'] = (int)($count * $bar_width/$total_cpus);
54 $cpu_models[$i]['bar_empty_width'] = $bar_width - $cpu_models[$i]['bar_width'];
55 }
56 $smarty->assign('cpu_models',$cpu_models);
57 }
37} 58}
38 59
39$smarty->assign('page_title','CPUs'); 60$smarty->assign('page_title','CPUs');
40$smarty->assign('total_cpus',number_format($total_cpus)); 61$smarty->assign('total_cpus',number_format($total_cpus));
41$smarty->display('cpus.tpl'); 62$smarty->display('cpus.tpl');

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.2

  ViewVC Help
Powered by ViewVC 1.1.20