Get journal stats for webui.
515632
public static Map<String, Map<String, String>> getJournalStats(
      Collection<Journal> journals) {
    Map<String, Map<String, String>> stats = new HashMap<String, Map<String, String>>();
    for (Journal j : journals) {
      try {
        Map<String, String> stat = new HashMap<String, String>();
        stats.put(j.getJournalId(), stat);
        stat.put("Txid committed", Long.toString(j.getCommittedTxnId()));
        stat.put("Txid segment", Long.toString(j.getCurrentSegmentTxId()));
        stat.put("Txid written", Long.toString(j.getHighestWrittenTxId()));
        stat.put("Current lag", Long.toString(j.getCurrentLagTxns()));
        stat.put("Writer epoch", Long.toString(j.getLastWriterEpoch()));
      } catch (IOException e) {
        LOG.error("Error when collectng stats", e);
      }
    }
    return stats;
  }
36925
def journal_history(self):
        
        jour = namedtuple('Journal', 'sourcetitle abbreviation type issn')
        path = ['author-profile', 'journal-history', 'journal']
        hist = [jour(sourcetitle=pub['sourcetitle'], issn=pub.get('issn'),
                     abbreviation=pub.get('sourcetitle-abbrev'),
                     type=pub['@type'])
                for pub in listify(chained_get(self._json, path, []))]
        return hist or None
203166
def _get_calculated_status(self):
        """"""
        if settings.PAGE_SHOW_START_DATE and self.publication_date:
            if self.publication_date > get_now():
                return self.DRAFT

        if settings.PAGE_SHOW_END_DATE and self.publication_end_date:
            if self.publication_end_date < get_now():
                return self.EXPIRED

        return self.status
1065035
def write_stats (self):
        """"""
        self.writeln()
        self.writeln(_("Statistics:"))
        if self.stats.downloaded_bytes is not None:
            self.writeln(_("Downloaded: %s.") % strformat.strsize(self.stats.downloaded_bytes))
        if self.stats.number > 0:
            self.writeln(_(
              "Content types: %(image)d image, %(text)d text, %(video)d video, "
              "%(audio)d audio, %(application)d application, %(mail)d mail"
              " and %(other)d other.") % self.stats.link_types)
            self.writeln(_("URL lengths: min=%(min)d, max=%(max)d, avg=%(avg)d.") %
                         dict(min=self.stats.min_url_length,
                         max=self.stats.max_url_length,
                         avg=self.stats.avg_url_length))
        else:
            self.writeln(_("No statistics available since no URLs were checked."))
1317352
def get_stats(self):
        '''
        
        '''
        resp = requests.get('%s/api/stats.json' % self.url)
        assert(resp.status_code == 200)
        return resp.json()
1222839
def retrieveVals(self):
        """"""
        lighttpdInfo = LighttpdInfo(self._host, self._port,
                                self._user, self._password, 
                                self._statuspath, self._ssl)
        stats = lighttpdInfo.getServerStats()
        if self.hasGraph('lighttpd_access'):
            self.setGraphVal('lighttpd_access', 'reqs', stats['Total Accesses'])
        if self.hasGraph('lighttpd_bytes'):
            self.setGraphVal('lighttpd_bytes', 'bytes', 
                             stats['Total kBytes'] * 1000)
        if self.hasGraph('lighttpd_servers'):
            self.setGraphVal('lighttpd_servers', 'busy', stats['BusyServers'])
            self.setGraphVal('lighttpd_servers', 'idle', stats['IdleServers'])
            self.setGraphVal('lighttpd_servers', 'max', stats['MaxServers'])
955113
def build_stats(counts):
    """"""
    stats = {
        'status': 0,
        'reportnum': counts['reportnum'],
        'title': counts['title'],
        'author': counts['auth_group'],
        'url': counts['url'],
        'doi': counts['doi'],
        'misc': counts['misc'],
    }
    stats_str = "%(status)s-%(reportnum)s-%(title)s-%(author)s-%(url)s-%(doi)s-%(misc)s" % stats
    stats["old_stats_str"] = stats_str
    stats["date"] = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
    stats["version"] = version
    return stats
598320
def get_stats(self):
        """"""
        self.gather_xml()
        self.xml_version = self.bs_xml.find('statistics')['version']

        if self.xml_version is None:
            raise XmlError("Unable to determine XML version via 'statistics' tag.")

        if self.xml_version == '3.6':
            self.stats = XmlV36(self.bs_xml)
        elif self.xml_version == '3.8':
            # 3.8 uses the same XML scheme as 3.6
            self.stats = XmlV36(self.bs_xml)
        elif self.xml_version == '3.11':
            # BIND 9.12 uses same XML schema as XmlV36
            self.stats = XmlV36(self.bs_xml)
        else:
            raise XmlError('Support must be added before being able to support newly-encountered XML version %s.' % self.xml_version)
906903
function getStats(options) {
  var stats = {};

  stats.entry = options.file || 'data';
  stats.start = Date.now();

  return stats;
}
908735
def get_stats(self):
        

        stats = yield from self._hypervisor.send("nio get_stats {}".format(self._name))
        return stats[0]
1189661
def GetReportData(self, get_report_args, token):
    """"""
    report = rdf_report_plugins.ApiReportData(
        representation_type=rdf_report_plugins.ApiReportData.RepresentationType
        .LINE_CHART)

    series_with_timestamps = client_report_utils.FetchAllGraphSeries(
        get_report_args.client_label,
        rdf_stats.ClientGraphSeries.ReportType.N_DAY_ACTIVE,
        period=rdfvalue.Duration("180d"))

    categories = {}
    for timestamp, graph_series in sorted(iteritems(series_with_timestamps)):
      self._ProcessGraphSeries(graph_series, timestamp, categories)

    graphs = []
    for k, v in iteritems(categories):
      graph = dict(label=k, data=v)
      graphs.append(graph)

    report.line_chart.data = sorted(
        (rdf_report_plugins.ApiReportDataSeries2D(
            label=label,
            points=(rdf_report_plugins.ApiReportDataPoint2D(x=x, y=y)
                    for x, y in points))
         for label, points in iteritems(categories)),
        key=lambda series: int(series.label.split()[0]),
        reverse=True)

    return report
1050729
def get_stats(self):
        
        sent = ctypes.c_uint32()
        recv = ctypes.c_uint32()
        send_errors = ctypes.c_uint32()
        recv_errors = ctypes.c_uint32()
        result = self.library.Par_GetStats(self.pointer, ctypes.byref(sent),
                                   ctypes.byref(recv),
                                   ctypes.byref(send_errors),
                                   ctypes.byref(recv_errors))
        check_error(result, "partner")
        return sent, recv, send_errors, recv_errors
1238202
def retrieveVals(self):
        """"""
        fs = FSinfo(self._fshost, self._fsport, self._fspass)
        if self.hasGraph('fs_calls'):
            count = fs.getCallCount()
            self.setGraphVal('fs_calls', 'calls', count)
        if self.hasGraph('fs_channels'):
            count = fs.getChannelCount()
            self.setGraphVal('fs_channels', 'channels', count)
1017596
def _get_nest_stats(self):
        
        for x in self.rdict:
            check = urlparse(x)
            if check.scheme:
                nested_dict = self.rdict[x]['nestedStats']
                tmp_dict = nested_dict['entries']
                return self._key_dot_replace(tmp_dict)

        return self._key_dot_replace(self.rdict)
724711
def retrieveVals(self):
        """"""
        fpminfo = PHPfpmInfo(self._host, self._port, self._user, self._password, 
                             self._monpath, self._ssl)
        stats = fpminfo.getStats()
        if self.hasGraph('php_fpm_connections') and stats: 
            self.setGraphVal('php_fpm_connections', 'conn', 
                             stats['accepted conn'])
        if self.hasGraph('php_fpm_processes') and stats: 
            self.setGraphVal('php_fpm_processes', 'active', 
                             stats['active processes'])
            self.setGraphVal('php_fpm_processes', 'idle', 
                             stats['idle processes'])
            self.setGraphVal('php_fpm_processes', 'total', 
                             stats['total processes'])
922004
def retrieveVals(self):
        """"""
        ntpinfo = NTPinfo()
        stats = ntpinfo.getHostOffset(self._remoteHost)
        if stats:
            graph_name = 'ntp_host_stratum_%s' % self._remoteHost
            if self.hasGraph(graph_name):
                self.setGraphVal(graph_name, 'stratum', stats.get('stratum'))
            graph_name = 'ntp_host_stat_%s' % self._remoteHost
            if self.hasGraph(graph_name):
                self.setGraphVal(graph_name, 'offset', stats.get('offset'))
                self.setGraphVal(graph_name, 'delay', stats.get('delay'))
898974
public static void getHTMLTableForASingleJournal(QJMStatus status,
      String journalName, StringBuilder sb) {
    List<StatsDescriptor> stats = status.stats.get(journalName);
    if (stats == null) {
      return;
    }
    Set<String> statsNames = status.statNames;

    // header
    sb.append("<table border=1 align=\"right\" cellpadding=1 "
        + "cellspacing=0 title=\"Journal statistics\">");
    sb.append("<thead><tr><td></td>");
    for (StatsDescriptor sd : stats) {
      sb.append("<td><b>" + sd.journalNode + "</b></td>");
    }
    sb.append("</tr></thead>");

    // contents
    for (String st : statsNames) {
      // for each available stat
      sb.append("<tr><td>" + st + "</td>");
      // for each available node
      for (StatsDescriptor sd : stats) {
        sb.append("<td align=\"right\">" + getValue(sd.statsPerJournal, st)
            + "</td>");
      }
      sb.append("</tr>");
    }
    sb.append("</table>");
  }