soc.2012.www-statscollector: e6258431: Add a pidginly interface and some more s...

sanket at soc.pidgin.im sanket at soc.pidgin.im
Wed May 30 23:56:32 EDT 2012


----------------------------------------------------------------------
Revision: e62584314a1d757f0dc4c59d5bf03216a10c1bc9
Parent:   70c0b05bb325070c22d8a849b85f56733ad0eb6f
Author:   sanket at soc.pidgin.im
Date:     05/29/12 05:56:15
Branch:   im.pidgin.soc.2012.www-statscollector
URL: http://d.pidgin.im/viewmtn/revision/info/e62584314a1d757f0dc4c59d5bf03216a10c1bc9

Changelog: 

Add a pidginly interface and some more stats

I have added an interace which is very similar to d.pidgin.im so that I can
see the aspect ratios. Also I have added following options for stats:

* Bitness of application
* Operating System (basic) type
* Architecture of the underlying hardware

Changes against parent 70c0b05bb325070c22d8a849b85f56733ad0eb6f

  patched  pidgin_stats_collector/display/views.py
  patched  pidgin_stats_collector/templates/display/index.html

-------------- next part --------------
============================================================
--- pidgin_stats_collector/display/views.py	36c56ff75812f8711e8d13a6ba0633869a4eac7b
+++ pidgin_stats_collector/display/views.py	b68fac47fc125af1a156dd5b94aab893bd638fdc
@@ -17,13 +17,18 @@ APP_BIT_STR = 'app-bit'
 
 # Application bitness
 APP_BIT_STR = 'app-bit'
+OS_BIT_STR = 'os-bit'
 APP_BIT = ('32', '64', 'unknown')
 
 # Major OS name
 OS_NAME_STR = 'os-name'
 OS_NAME = ('linux', 'windows', 'mac', 'unknown')
 
+# Types of architectures
+ARCH_NAME_STR = 'arch-name'
+ARCH_NAME = ('x86', 'x86_64', 'ppc', 'ppc64', 'ia64', 'unknown')
 
+
 def init_stats_dict():
 
   """
@@ -46,6 +51,12 @@ def init_stats_dict():
   # App bitness
   stats_d[APP_BIT_STR] = dict(zip(APP_BIT, [0]*len(APP_BIT)))
 
+  # OS bitness
+  stats_d[OS_BIT_STR] = dict(zip(APP_BIT, [0]*len(APP_BIT)))
+
+  # Arch name
+  stats_d[ARCH_NAME_STR] = dict(zip(ARCH_NAME, [0]*len(ARCH_NAME)))
+
   return stats_d
 
 def process_stats():
@@ -63,6 +74,8 @@ def process_stats():
   stats_dict = init_stats_dict()
   stats_os_name = stats_dict[OS_NAME_STR]
   stats_app_bit = stats_dict[APP_BIT_STR]
+  stats_os_bit = stats_dict[OS_BIT_STR]
+  stats_arch_name = stats_dict[ARCH_NAME_STR]
 
   for o in RawXML.objects.all():
 
@@ -94,6 +107,30 @@ def process_stats():
       stats_app_bit[app_bit] += 1
     else: stats_app_bit['unknwon'] += 1
 
+    # The bitness of the kernel
+    e2 = stats_dom.xpathEval('/stats/cpuinfo/cpu/os-bit')
+    os_bit = str(e2[0].get_content())
+
+    if os_bit in stats_os_bit:
+      stats_os_bit[os_bit] += 1
+    else: stats_os_bit['unknwon'] += 1
+
+    # Type of architecture we are dealing with
+    e3 = stats_dom.xpathEval('/stats/cpuinfo/cpu/arch')
+    arch_id = e3[0].hasProp('id')
+
+    if(arch_id):
+
+      arch_name = arch_id.get_content().lower()
+
+      if arch_name == 'amd64': arch_name = 'x86_64'
+      elif arch_name in ['i386', 'i486', 'i586', 'i686']:
+        arch_name = 'x86'
+
+      if arch_name in ARCH_NAME:
+        stats_arch_name[arch_name] += 1
+      else: stats_arch_name['unknown'] += 1
+
   print stats_dict
   return stats_dict
 
@@ -104,4 +141,7 @@ def index(request):
   return render_to_response('display/index.html',{
       'os_name': simplejson.dumps(list(stats_dict[OS_NAME_STR].iteritems())),
       'app_bit': list(stats_dict[APP_BIT_STR].values()),
+      'os_bit': list(stats_dict[OS_BIT_STR].values()),
+      'arch_name': list(stats_dict[ARCH_NAME_STR].values()),
+      'arch_pie': simplejson.dumps(list(stats_dict[ARCH_NAME_STR].iteritems())),
     });
============================================================
--- pidgin_stats_collector/templates/display/index.html	d25a1f8b9b2ac2d9f220a13d2bbf52128ff4454e
+++ pidgin_stats_collector/templates/display/index.html	3e236eeb308e2d300e80afbcac1a4cae8e876189
@@ -1,24 +1,157 @@
+<html xmlns="http://www.w3.org/1999/xhtml"><head>
+    <title>
+      UsingPidginMonotone -
+      Pidgin - Trac
+    </title>
+        <link rel="search" href="/search">
+        <link rel="help" href="/wiki/TracGuide">
+        <link rel="alternate" href="/wiki/UsingPidginMonotone?format=txt" type="text/x-trac-wiki" title="Plain Text">
+        <link rel="up" href="/wiki/UsingPidginMonotone" title="View Latest Version">
+        <link rel="start" href="/wiki">
+        <link rel="stylesheet" href="/media/css/trac.css" type="text/css"><link rel="stylesheet" href="/chrome/common/css/wiki.css" type="text/css">
+        <link rel="shortcut icon" href="/static/pidgin.ico" type="image/x-icon">
+        <link rel="icon" href="/static/pidgin.ico" type="image/x-icon">
+      <link type="application/opensearchdescription+xml" rel="search" href="/search/opensearch" title="Search Pidgin">
+    <script type="text/javascript" src="/media/js/jquery-1.3.2.min.js"></script><script type="text/javascript" src="/media/js/trac.js"></script><script type="text/javascript" src="/media/js/search.js"></script>
+	<script src="/media/js/highcharts.js"></script>
+	<script src="/media/js/modules/exporting.js"></script>
 
+    <script type="text/javascript">
+      jQuery(document).ready(function($) {
+        $("#content").find("h1,h2,h3,h4,h5,h6").addAnchor("Link to this section");
+      });
+    </script>
+<style type="text/css">
+ at import url("/media/css/style.css");
+ at import url("/media/css/pidgin-trac.css");
+</style>
+  </head>
+  <body>
+    <div id="BodyWrapper">
+      <div id="Container">
+        <div class="TopNavigation">
+          <a href="http://pidgin.im/"><img class="TitleImage" alt="Pidgin" src="/media/img/pidgin_logo.jpg" height="58" width="133"></a>
+          <ul>
+            <li><a href="http://pidgin.im/download">Download</a></li>
+	    <li><a href="http://developer.pidgin.im/wiki/ThirdPartyPlugins">Plugins</a></li>
+	    <li><a href="http://pidgin.im/support/">Help</a></li>
+            <li><a href="http://pidgin.im/about">About</a></li>
+            <li><a href="http://pidgin.im/news">News</a></li>
+            <li class="Selected"><a href="http://developer.pidgin.im/">Development</a></li>
+          </ul>
+        </div>
+    <div id="banner">
+      <div id="header">
+        <a id="logo" href="http://developer.pidgin.im/"><img src="/media/img/header.png" alt=""></a>
+      </div>
+      <form id="search" action="/search" method="get">
+        <div>
+          <label for="proj-search">Search:</label>
+          <input type="text" id="proj-search" name="q" size="18" value="">
+          <input type="submit" value="Search">
+        </div>
+      </form>
+      <div id="metanav" class="nav">
+    <ul>
+      <li class="first"><a href="/login">Login</a></li><li><a href="/wiki/TracGuide">Help/Guide</a></li><li><a href="/about">About Trac</a></li><li><a href="/notification" title="Wiki Pages Change Notifications">My Notifications</a></li><li><a href="/register">Register</a></li><li class="last"><a href="/prefs">Preferences</a></li>
+    </ul>
+  </div>
+    </div>
+    <div id="mainnav" class="nav">
+    <ul>
+      <li class="first active"><a href="/wiki">Wiki</a></li><li><a href="/timeline">Timeline</a></li><li><a href="/roadmap">Roadmap</a></li><li><a href="/report">View Tickets</a></li><li><a href="/search">Search</a></li><li class="last"><a href="/doxygen">API</a></li>
+    </ul>
+  </div>
+    <div id="main">
+	<div id="content">
+		<h1>Stats collection for libpurple based clients</h1>
+			<p>This page outlays the various statistics that we have collected from different clients
+			that run libpurple as their backend (core protocol library) and also support plugins written for
+			libpurple. Major clients that are included contain, Pidgin, Finch, Adium etc.
+		</p>
+		
+		<h2>Operating System information</h2>
+		<div id="os-hc" style="min-width: 400px; height: 400px; margin: 0 auto"></div>
+		
+		<h2>32/64 bit application</h2>
+		<div id="app-bit" style="min-width: 400px; height: 200px; margin: 0 auto"></div>
+		
+		<h2>Hardware architecture</h2>
+		<div id="arch-bar" style="min-width: 400px; height: 200px; margin: 0 auto"></div>
 
-<h1>Stats Display!</h1>
-
-<h2>Os type information</h2>
-<script type="text/javascript" src="/media/js/jquery-1.3.2.min.js"></script>
-<script src="/media/js/highcharts.js"></script>
-<script src="/media/js/modules/exporting.js"></script>
+		<div id="arch-pie" style="min-width: 400px; height: 400px; margin: 0 auto"></div>
+		
+	</div>
+    <div id="altlinks">
+      <h3>Download in other formats:</h3>
+      <ul>
+        <li class="last first">
+          <a rel="nofollow" href="/wiki/UsingPidginMonotone?format=txt">Plain Text</a>
+        </li>
+      </ul>
+    </div>
+    </div>
+    <div id="footer" lang="en" xml:lang="en"><hr>
+      <a id="tracpowered" href="http://trac.edgewall.org/"><img src="/media/img/trac_logo_mini.png" height="30" width="107" alt="Trac Powered"></a>
+      <p class="left">
+        Powered by <a href="/about"><strong>Trac 0.11.1</strong></a><br>
+        By <a href="http://www.edgewall.org/">Edgewall Software</a>.
+      </p>
+      <p class="right">Visit the Trac open source project at<br><a href="http://trac.edgewall.org/">http://trac.edgewall.org/</a></p>
+    </div>
+        <div style="color: #666; font-size: 11px; padding: 1em 0; text-align: center;">All information, including names and email addresses, entered onto this website or sent to mailing lists affiliated with this website will be <u>public</u>.  Do not post confidential information, especially passwords!</div>
+      <br>
+      </div>
+    </div>
+  
+  <!-- Google Analytics Widget Code -->
 <script type="text/javascript">
+  var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
+  document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
+</script><script src="http://www.google-analytics.com/ga.js" type="text/javascript"></script>
+<script type="text/javascript">
+  jQuery(document).ready( function() {
+    var pageTracker = _gat._getTracker("UA-2814037-1");
+    pageTracker._setDomainName(".pidgin.im");
+    pageTracker._initData();
+    pageTracker._trackPageview();
+    jQuery('a').each( function() {
+      var url;
+      if ( this.href.match("http:\/\/developer.pidgin.im") ) {
+        if ( this.href.match(/\.(.)$/) ) {
+          url = this.pathname + this.search;
+        };
+      } else {
+        var port = '';
+        if ( this.port != '') port = ':'+this.port;
+        url = '/external/' + this.hostname + port + this.pathname + this.search;
+      };
+      if ( url ) {
+        if ( ! url.match('^\/attachment\/') ) {
+          jQuery(this).click( function() {
+            pageTracker._trackPageview(url);
+          });
+        };
+      };
+    });
+  });
+</script>
+
+<!-- Scripts from Highcharts, I would prefer to pack them in a separate JS but for now this works! -->
+
+<script type="text/javascript"> <!-- OS Name HC JS -->
 $(function () {
     var chart;
     $(document).ready(function() {
         chart = new Highcharts.Chart({
             chart: {
-                renderTo: 'os-name',
+                renderTo: 'os-hc',
                 plotBackgroundColor: null,
                 plotBorderWidth: null,
-                plotShadow: false
+                plotShadow: true
             },
             title: {
-                text: 'Browser market shares at a specific website, 2010'
+                text: 'OS Info'
             },
             tooltip: {
                 formatter: function() {
@@ -50,93 +183,91 @@ $(function () {
 });
 </script>
 
-<div id="os-name" style="min-width: 400px; height: 400px; margin: 0 auto"></div>
-<h2>Bitness of the application</h2>
-<script>
+<script type="text/javascript"> <!-- Application bitness -->
 $(function () {
     var chart;
     $(document).ready(function() {
         chart = new Highcharts.Chart({
             chart: {
                 renderTo: 'app-bit',
-                type: 'column',
-                margin: [ 50, 50, 100, 80]
+                type: 'bar'
             },
             title: {
-                text: 'bitness of application'
+                text: 'Bitness of application'
             },
+
             xAxis: {
-                categories: ['32 bit applications', '64 bit applications'],
-                labels: {
-                    rotation: -45,
-                    align: 'right',
-                    style: {
-                        fontSize: '13px',
-                        fontFamily: 'Verdana, sans-serif'
-                    }
+                categories: ['Application', 'Operating System'],
+                title: {
+                    text: null
                 }
             },
-            plotOptions: {
-                bar: {
-                    stacking: 'percent'
-                }
-            },
             yAxis: {
                 min: 0,
                 title: {
-                    text: 'Bitness of application'
+                    text: '32/64 Bitness',
+                    align: 'high'
                 }
-            },
-            legend: {
-                enabled: false
-            },
+            }, 
             tooltip: {
                 formatter: function() {
-                    return '<b>'+ this.x +'</b><br/>'+
-                    Highcharts.numberFormat(this.y, 1) +' %';
+                    return ''+
+                        this.series.name +': '+ this.y +' %';
                 }
             },
-                series: [{
-                name: 'Population',
-                data: [10,12],
-                dataLabels: {
-                    enabled: true,
-                    rotation: -90,
-                    color: '#FFFFFF',
-                    align: 'right',
-                    x: -3,
-                    y: 10,
-                    formatter: function() {
-                        return this.y;
+            plotOptions: {
+                bar: {
+                    dataLabels: {
+                        enabled: true,
                     },
-                    style: {
-                        fontSize: '13px',
-                        fontFamily: 'Verdana, sans-serif'
-                    }
+                    stacking: 'percent'
                 }
+            },
+            legend: {
+                layout: 'vertical',
+                align: 'right',
+                verticalAlign: 'top',
+                x: -100,
+                y: 100,
+                floating: true,
+                borderWidth: 1,
+                backgroundColor: '#FFFFFF',
+                shadow: true
+            },
+            credits: {
+                enabled: false
+            },
+            series: [{
+                name: '32 bit',
+                data: [{{ app_bit.0 }}, {{ os_bit.0 }}]
+            }, {
+                name: '64 bit',
+                data: [{{ app_bit.1 }}, {{ os_bit.1 }}]
+            }, {
+                name: 'unknown',
+                data: [{{ app_bit.2 }}, {{ os_bit.2 }}]
             }]
         });
     });
     
 });
-		</script>
-<div id="app-bit" style="width: 500px; height: 400px; margin: 0 auto"></div>
+</script>
 
-<script type="text/javascript">
+<script type="text/javascript"> <!-- Architecture type information -->
 $(function () {
     var chart;
     $(document).ready(function() {
         chart = new Highcharts.Chart({
             chart: {
-                renderTo: 'container',
+                renderTo: 'arch-bar',
                 type: 'bar'
             },
             title: {
-                text: 'Bitness of application'
+                text: 'Types of architecture'
             },
 
             xAxis: {
-                categories: ['Bitness of application'],
+                categories: ['Architectures'],
                 title: {
                     text: null
                 }
@@ -144,10 +275,10 @@ $(function () {
             yAxis: {
                 min: 0,
                 title: {
-                    text: 'Application bitness',
+                    text: 'Various Architectures',
                     align: 'high'
                 }
-            },
+            }, 
             tooltip: {
                 formatter: function() {
                     return ''+
@@ -177,19 +308,72 @@ $(function () {
                 enabled: false
             },
             series: [{
-                name: '32 bit',
-                data: [{{ app_bit.0 }}]
+                name: 'x86',
+                data: [{{ arch_name.0 }}]
             }, {
-                name: '64 bit',
-                data: [{{ app_bit.1 }}]
+                name: 'x86_64',
+                data: [{{ arch_name.1 }}]
             }, {
+                name: 'ppc',
+                data: [{{ arch_name.2 }}]
+            }, {
+                name: 'ppc64',
+                data: [{{ arch_name.3 }}]
+            }, {
+                name: 'ia64',
+                data: [{{ arch_name.4 }}]
+            }, {
                 name: 'unknown',
-                data: [{{ app_bit.2 }}]
+                data: [{{ arch_name.5 }}]
             }]
         });
     });
     
 });
-		</script>
-		
-		<div id="container" style="width: 300px; height: 200px; margin: 0 auto"></div>
\ No newline at end of file
+</script>
+
+<script type="text/javascript"> <!-- Arch name, pie chart -->
+$(function () {
+    var chart;
+    $(document).ready(function() {
+        chart = new Highcharts.Chart({
+            chart: {
+                renderTo: 'arch-pie',
+                plotBackgroundColor: null,
+                plotBorderWidth: null,
+                plotShadow: true
+            },
+            title: {
+                text: 'OS Info'
+            },
+            tooltip: {
+                formatter: function() {
+                    return '<b>'+ this.point.name +'</b>: '+ this.percentage +' %';
+                }
+            },
+            plotOptions: {
+                pie: {
+                    allowPointSelect: true,
+                    cursor: 'pointer',
+                    dataLabels: {
+                        enabled: true,
+                        color: '#000000',
+                        connectorColor: '#000000',
+                        formatter: function() {
+                            return '<b>'+ this.point.name +'</b>: '+ this.percentage +' %';
+                        }
+                    }
+                }
+            },
+            series: [{
+                type: 'pie',
+                name: 'OS Share',
+                data: {{ arch_pie|safe }},
+            }]
+        });
+    });
+    
+});
+</script>
+
+</body></html>
\ No newline at end of file


More information about the Commits mailing list