]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
dvb: add adapter bandwidth to status page.
authorAdam Sutton <dev@adamsutton.me.uk>
Sat, 2 Feb 2013 11:47:38 +0000 (11:47 +0000)
committerAdam Sutton <dev@adamsutton.me.uk>
Sat, 2 Feb 2013 11:48:30 +0000 (11:48 +0000)
src/dvb/dvb.h
src/dvb/dvb_adapter.c
src/dvb/dvb_fe.c
src/webui/static/app/status.js
src/webui/static/app/tvadapters.js

index 468b927184236bb61d6e3e20e6906a5d1050b72f..aaccd94600bc1ae077fbdc91361eb1ba0f519e7f 100644 (file)
@@ -265,6 +265,8 @@ typedef struct th_dvb_adapter {
 
   int tda_rawmode;
 
+  int tda_bytes;
+
   // Full mux streaming, protected via the delivery mutex
 
   streaming_pad_t tda_streaming_pad;
index 570c0a774151c258b18f8f5f9fd711754b165490..07172ea80258dfd69c597553c60036142d8e839c 100644 (file)
@@ -47,6 +47,7 @@
 #include "service.h"
 #include "epggrab.h"
 #include "diseqc.h"
+#include "atomic.h"
 
 struct th_dvb_adapter_queue dvb_adapters;
 struct th_dvb_mux_instance_tree dvb_muxes;
@@ -1063,6 +1064,7 @@ dvb_adapter_input_dvr(void *aux)
       }
     }
     r += c;
+    atomic_add(&tda->tda_bytes, c);
 
     /* not enough data */
     if (r < 188) continue;
index 0f27b898a5de9360bc21e01081fb6b796fa4aaa5..779e79b301f5877329f697a58dab19a6c0cd9cc8 100644 (file)
@@ -41,6 +41,7 @@
 #include "dvr/dvr.h"
 #include "service.h"
 #include "streaming.h"
+#include "atomic.h"
 
 #include "epggrab.h"
 
@@ -90,7 +91,7 @@ dvb_fe_monitor(void *aux)
 {
   th_dvb_adapter_t *tda = aux;
   fe_status_t fe_status;
-  int status, v, vv, i, fec, q;
+  int status, v, vv, i, fec, q, bw;
   th_dvb_mux_instance_t *tdmi = tda->tda_mux_current;
   char buf[50];
   signal_status_t sigstat;
@@ -218,6 +219,8 @@ dvb_fe_monitor(void *aux)
     }
   }
 
+  bw = atomic_exchange(&tda->tda_bytes, 0);
+
   if(notify) {
     htsmsg_t *m = htsmsg_create_map();
     htsmsg_add_str(m, "id", tdmi->tdmi_identifier);
@@ -238,6 +241,7 @@ dvb_fe_monitor(void *aux)
     htsmsg_add_u32(m, "ber", tdmi->tdmi_ber);
     htsmsg_add_u32(m, "unc", tdmi->tdmi_unc);
     htsmsg_add_dbl(m, "uncavg", tdmi->tdmi_unc_avg);
+    htsmsg_add_u32(m, "bw", bw);
     notify_by_msg("tvAdapter", m);
   }
 
index 3ecf1f17f6ad3983bedee3d3463b7a49fdf1e410..5aacae41c8c0f163d328a2b07ebbea5e14d6a77f 100644 (file)
@@ -148,6 +148,10 @@ tvheadend.status_adapters = function() {
                colored : true
        });
 
+       function renderBw(value) {
+               return parseInt(value / 125);
+       }
+
        var cm = new Ext.grid.ColumnModel([{
                width : 50,
                header : "Name",
@@ -160,6 +164,11 @@ tvheadend.status_adapters = function() {
                width : 100,
                header : "Currently tuned to",
                dataIndex : 'currentMux'
+        },{
+               width : 100,
+               header : "Bandwidth (kb/s)",
+               dataIndex : 'bw',
+               renderer: renderBw
         },{
                width : 50,
                header : "Bit error rate",
@@ -198,9 +207,6 @@ tvheadend.status_adapters = function() {
         return panel;
 }
 
-
-
-
 tvheadend.status = function() {
 
         var panel = new Ext.Panel({
index dc14c198d2710221bdc06c4aab93e3e776e4bc31..3661fabd1ebbf1e5c805c758b37fc18b90ed818a 100644 (file)
@@ -7,7 +7,7 @@ tvheadend.tvAdapterStore = new Ext.data.JsonStore({
        fields : [ 'identifier', 'type', 'name', 'path', 'devicename',
                   'hostconnection', 'currentMux', 'services', 'muxes', 'initialMuxes',
                   'satConf', 'deliverySystem', 'freqMin', 'freqMax', 'freqStep',
-                  'symrateMin', 'symrateMax',  'signal', 'snr', 'ber', 'unc', 'uncavg'],
+                  'symrateMin', 'symrateMax',  'signal', 'snr', 'ber', 'unc', 'uncavg', 'bw'],
        url : 'tv/adapter'
 });