Changeset 197
- Timestamp:
- 07/20/11 13:25:39 (13 years ago)
- Location:
- trunk/plugins/CacheCoveragePlugin
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/plugins/CacheCoveragePlugin/README.CacheCoveragePlugin.txt
r193 r197 50 50 - cache-contents: Show aggregated cache stats for all known contexts (services in cache, per context). 51 51 optional parameters: hide-expired (true/false, exclude service entries that are older than their context cw validity). 52 source-filter (only display entries which have this reported source address string) 52 53 53 54 - cache-sources: Show stats per cache data source address. … … 56 57 - service-backlog: Show transaction backlog and current sources for selected service (last 60s). 57 58 59 - transponder-list: Show services per transponder for locally known profiles (as parsed from services file). 60 mandatory parameters: profile (name of local profile) 61 optional parameters: tid (transponder id, in hex) 62 58 63 Usage example 59 64 ------------- -
trunk/plugins/CacheCoveragePlugin/src/com/bowman/cardserv/CacheCoveragePlugin.java
r193 r197 9 9 10 10 import java.io.*; 11 import java.nio.channels.Pipe;12 11 import java.util.*; 13 12 … … 192 191 public void runStatusCmdCacheContents(XmlStringBuffer xb, Map params) { 193 192 boolean hideExpired = "true".equals(params.get("hide-expired")); 194 xmlFormatCacheContents(xb, hideExpired); 193 String sourceStr = (String)params.get("source-filter"); 194 if("".equals(sourceStr)) sourceStr = null; 195 SourceCacheEntry source = null; 196 if(sourceStr != null) source = (SourceCacheEntry)sources.get(sourceStr.toUpperCase()); 197 xmlFormatCacheContents(xb, hideExpired, source); 195 198 } 196 199 … … 215 218 } 216 219 217 public void xmlFormatCacheContents(XmlStringBuffer xb, boolean hideExpired) { 220 public void runStatusCmdListTransponders(XmlStringBuffer xb, Map params) { 221 String profile = (String)params.get("profile"); 222 String tidStr = (String)params.get("tid"); 223 int tid = -1; 224 if(tidStr != null) tid = Integer.parseInt(tidStr, 16); 225 if(profile != null) xmlFormatTransponderList(xb, profile, tid); 226 } 227 228 public void xmlFormatTransponderList(XmlStringBuffer xb, String profileName, int tidFilter) { 229 xb.appendElement("transponder-list", "profile", profileName); 230 CaProfile profile = config.getProfile(profileName); 231 if(profile != null) { 232 Map allServices = profile.getServices(); 233 Map tpMap = new TreeMap(); 234 TransponderEntry entry; 235 TvService ts; String key; 236 for(Iterator iter = allServices.values().iterator(); iter.hasNext(); ) { 237 ts = (TvService)iter.next(); 238 key = profileName + "-" + Long.toHexString(ts.getTransponder()); 239 entry = (TransponderEntry)tpMap.get(key); 240 if(entry == null) { 241 entry = new TransponderEntry(ts.getTransponder(), profileName); 242 tpMap.put(key, entry); 243 } 244 entry.addService(ts); 245 } 246 xb.appendAttr("count", tpMap.size()); 247 xb.endElement(false); 248 for(Iterator iter = tpMap.values().iterator(); iter.hasNext(); ) { 249 entry = (TransponderEntry)iter.next(); 250 if(tidFilter == -1) xmlFormatTransponder(xb, entry); 251 else if(tidFilter == entry.tid) xmlFormatTransponder(xb, entry); 252 } 253 } 254 xb.closeElement("transponder-list"); 255 } 256 257 public void xmlFormatTransponder(XmlStringBuffer xb, TransponderEntry entry) { 258 xb.appendElement("transponder", "id", (int)entry.tid); 259 xb.appendAttr("service-count", entry.services.size()); 260 xb.appendAttr("sd-count", entry.sd); 261 xb.appendAttr("hd-count", entry.hd); 262 xb.appendAttr("radio-count", entry.radio); 263 xb.endElement(false); 264 XmlHelper.xmlFormatServices((TvService[])entry.services.toArray(new TvService[entry.services.size()]), xb, false, false, null); 265 xb.closeElement("transponder"); 266 } 267 268 public void xmlFormatCacheContents(XmlStringBuffer xb, boolean hideExpired, SourceCacheEntry filter) { 218 269 xb.appendElement("cache-contents", "contexts", cacheMaps.size()); 219 270 xb.appendAttr("sources", sources.size()); … … 232 283 xb.appendAttr("total-seen", map.size()); 233 284 xb.endElement(false); 234 xmlFormatCacheContext(xb, new TreeSet(map.values()), hideExpired );285 xmlFormatCacheContext(xb, new TreeSet(map.values()), hideExpired, filter); 235 286 xb.closeElement("cache-context"); 236 287 } … … 316 367 } 317 368 318 public static void xmlFormatCacheContext(XmlStringBuffer xb, Set entries, boolean hideExpired ) {369 public static void xmlFormatCacheContext(XmlStringBuffer xb, Set entries, boolean hideExpired, SourceCacheEntry filter) { 319 370 ServiceCacheEntry sce; 371 320 372 for(Iterator iter = entries.iterator(); iter.hasNext(); ) { 321 373 sce = (ServiceCacheEntry)iter.next(); 322 374 if(hideExpired && sce.isExpired()) continue; 375 if(filter != null && !sce.getSources(false).contains(filter)) continue; 323 376 int avgInterval = sce.getAvgInterval(); 324 377 int avgVariance = sce.getAvgVariance(); … … 366 419 } 367 420 421 static class TransponderEntry { 422 423 long tid; 424 String profile; 425 int radio, sd, hd; 426 427 Set services = new TreeSet(); 428 429 TransponderEntry(long tid, String profile) { 430 this.tid = tid; 431 this.profile = profile; 432 } 433 434 void addService(TvService ts) { 435 switch(ts.getType()) { 436 case TvService.TYPE_TV: 437 sd++; 438 break; 439 case TvService.TYPE_HDTV_MPEG2: 440 case TvService.TYPE_HDTV_MPEG4: 441 hd++; 442 break; 443 case TvService.TYPE_RADIO: 444 radio++; 445 break; 446 } 447 services.add(ts); 448 } 449 } 450 368 451 } -
trunk/plugins/CacheCoveragePlugin/src/com/bowman/cardserv/ServiceCacheEntry.java
r193 r197 161 161 if(continuityErrors > 0) { 162 162 resetContinuityErrors(); 163 System.out.println(this + " Continous for " + continuityCount * expectedInterval);163 // System.out.println(this + " Continous for " + continuityCount * expectedInterval); 164 164 } 165 165 continuityCount = 0; -
trunk/plugins/CacheCoveragePlugin/src/com/bowman/cardserv/SourceCacheEntry.java
r193 r197 57 57 } 58 58 59 public boolean equals(Object o) { 60 if(this == o) return true; 61 if(o == null || getClass() != o.getClass()) return false; 62 SourceCacheEntry that = (SourceCacheEntry)o; 63 if(!sourceStr.equals(that.sourceStr)) return false; 64 return true; 65 } 66 67 public int hashCode() { 68 return sourceStr.hashCode(); 69 } 59 70 60 71 static class ReplyTuple { -
trunk/plugins/CacheCoveragePlugin/src/com/bowman/cardserv/status-commands.xml
r193 r197 5 5 6 6 <command name="cache-contents" label="Show current cache contents" description="List currently cached services with aggregated stats." admin-only="true"> 7 <command-param name="source-filter" label="" optional="true"/> 7 8 <command-param name="hide-expired" label="" optional="true"> 8 9 <option value="true"/> … … 27 28 </command> 28 29 30 <command name="list-transponders" label="Show transponder details" description="List services per transponder (as parsed from services file)" admin-only="true"> 31 <command-param name="tid" label="" optional="true"/> 32 <command-param name="profile" label="" optional="false"/> 33 </command> 34 35 29 36 </status-commands> -
trunk/plugins/CacheCoveragePlugin/web/load.js
r193 r197 4 4 5 5 var hideExpiredEntries = true, hideLocalSources = false; 6 var sourceFilter = ''; 6 7 7 8 //add the postProcess function to cs-status.js … … 19 20 if(hideExpiredEntries) getFirstByTag('cache-contents', xml).setAttribute('hide-expired', 'true'); 20 21 if(hideLocalSources) getFirstByTag('cache-sources', xml).setAttribute('hide-local', 'true'); 22 if(sourceFilter != '') getFirstByTag('cache-contents', xml).setAttribute('source-filter', sourceFilter); 21 23 22 24 var services = xml.getElementsByTagName('service'); … … 38 40 layerId = 'toggle-' + layerId.substring(layerId.lastIndexOf('/') + 1); 39 41 anchors[i].href = 'javascript:BowWeb.toggleVisibility("' + layerId + '");'; 42 } else if(anchors[i].id == 'filterhref') { 43 anchors[i].href = 'javascript:toggleFilter("' + anchors[i].href.toUpperCase() + '");'; 40 44 } 41 45 } … … 45 49 getById('hideExpiredCb').onclick = function() { 46 50 if(isBusy()) return false; 47 sections.cache.queries[2] = 'cache-contents hide-expired="' + this.checked + '" ';51 sections.cache.queries[2] = 'cache-contents hide-expired="' + this.checked + '" source-filter="' + sourceFilter + '"'; 48 52 hideExpiredEntries = this.checked; 49 53 selectSection(); … … 69 73 } 70 74 75 function toggleFilter(sourceStr) { 76 if(sourceFilter == sourceStr) sourceFilter = ''; 77 else sourceFilter = sourceStr; 78 sections.cache.queries[2] = 'cache-contents hide-expired="' + hideExpiredEntries + '" source-filter="' + sourceFilter + '"'; 79 selectSection(); 80 } 81 71 82 function cacheCoveragePluginPostProcess() { 72 83 if(getCookie('isAdmin') == 'true') { -
trunk/plugins/CacheCoveragePlugin/web/open/xslt/cws-status-resp.xsl
r193 r197 36 36 <xsl:call-template name="cache-sources"/> 37 37 <br /> 38 <xsl:if test="count(//service) > 0">39 38 <strong>Services: </strong><xsl:value-of select="count(//service)"/><br /> 39 <xsl:if test="@source-filter"><strong>Filter: </strong><xsl:value-of select="@source-filter"/>  40 <a id="filterhref"> 41 <xsl:attribute name="href"><xsl:value-of select="@source-filter"/></xsl:attribute> 42 <xsl:attribute name="title">Remove source filter</xsl:attribute>(show all) 43 </a> 44 <br /> 45 </xsl:if> 40 46 <br /> 41 47 <div style="width: 750px;"> … … 56 62 <td title="Update count"><strong>Uc</strong></td><td title="Current age"><strong>Age</strong></td> 57 63 <td title="Average interval (measured)"><strong>Iv</strong></td><td title="Average variance (from expected interval)"><strong>Var</strong></td> 58 <td title="Continuity errors ( gaps)"><strong>Ce</strong></td><td title="Total continuity errors"><strong>CeT</strong></td>64 <td title="Continuity errors (within last hour)"><strong>Ce</strong></td><td title="Total continuity errors"><strong>CeT</strong></td> 59 65 <td title="Overwrites (with different dcw)"><strong>Ow</strong></td><td title="Duplicates"><strong>Du</strong></td> 60 66 <td title="Aborted requests (cancelled locks)"><strong>Ab</strong></td> … … 67 73 <td colspan="15" align="left" bgcolor="#dddddd"> 68 74 <div><xsl:value-of select="@key"/> 69 (<xsl:if test="@local-name">local-name: <strong><xsl:value-of select="@local-name"/></strong>, </xsl:if> 75 (<xsl:if test="@local-name">local-name: <strong> 76 <a target="_blank"> 77 <xsl:attribute name="href">/xmlHandler?command=list-transponders&profile=<xsl:value-of select="@local-name"/></xsl:attribute> 78 <xsl:attribute name="title">Show transponder details (from local services file)</xsl:attribute> 79 <xsl:value-of select="@local-name"/> 80 </a></strong>, 81 </xsl:if> 70 82 expected-interval: <xsl:value-of select="@expected-interval"/>, 71 83 total-seen: <xsl:value-of select="@total-seen"/>, current-count: <xsl:value-of select="count(service)"/>)</div> … … 88 100 </td> 89 101 <td><xsl:value-of select="@id"/></td> 90 <td><xsl:if test="@tid"><xsl:value-of select="@tid"/></xsl:if></td> 102 <td><xsl:if test="@tid"> 103 <a target="_blank"> 104 <xsl:attribute name="href">/xmlHandler?command=list-transponders&profile=<xsl:value-of select="../@local-name"/>&tid=<xsl:value-of select="@tid"/></xsl:attribute> 105 <xsl:attribute name="title">Show transponder details (from local services file)</xsl:attribute> 106 <xsl:value-of select="@tid"/> 107 </a> 108 </xsl:if></td> 91 109 <td> 92 110 <xsl:choose> … … 136 154 </tbody></table> 137 155 </div><br /> 138 </xsl:if>139 156 </xsl:template> 140 157 … … 164 181 <xsl:attribute name="bgcolor">#ffffff</xsl:attribute> 165 182 </xsl:if> 166 <td>  <xsl:value-of select="@name"/></td> 183 <td> 184    185 <a id="filterhref"> 186 <xsl:attribute name="href"><xsl:value-of select="@name"/></xsl:attribute> 187 <xsl:attribute name="title">Toggle filtering service entries for this source</xsl:attribute> 188 <xsl:value-of select="@name"/> 189 </a> 190 </td> 167 191 <td><xsl:value-of select="@label"/></td> 168 192 <td><xsl:value-of select="@update-count"/></td>
Note:
See TracChangeset
for help on using the changeset viewer.