示例#1
0
文件: process.c 项目: huayl/pelikan
static void
_admin_stats_default(struct response *rsp, struct request *req)
{
    procinfo_update();
    rsp->data.data = buf;
    rsp->data.len = print_stats(buf, cap, (struct metric *)&stats, nmetric);
}
示例#2
0
static void
_admin_stats(struct response *rsp, struct request *req)
{
    size_t offset = 0;
    struct metric *metrics = (struct metric *)&stats;

    INCR(admin_metrics, stats);

    procinfo_update();
    for (int i = 0; i < nmetric; ++i) {
        offset += metric_print(stats_buf + offset, stats_len - offset,
                METRIC_PRINT_FMT, &metrics[i]);
    }
    strcpy(stats_buf + offset, METRIC_END);

    rsp->type = RSP_GENERIC;
    rsp->data.data = stats_buf;
    rsp->data.len = offset + METRIC_END_LEN;
}