Beispiel #1
0
static int
parse_swift_info(char *buf)
{
    char *line;
    line = strtok(buf, "\n");
    while (line != NULL) {
        read_swift_value(line, SWIFT_STORE[0], &stats.c_act);
        read_swift_value(line, SWIFT_STORE[1], &stats.c_conn);
        read_swift_value(line, SWIFT_STORE[2], &stats.s_act);
        read_swift_value(line, SWIFT_STORE[3], &stats.s_conn);
        read_swift_value(line, SWIFT_STORE[4], &stats.s_wait);
        line = strtok(NULL, "\n");
    }
    return 0;
}
Beispiel #2
0
int
parse_swift_info(char *buf)
{
    char *line;
    line = strtok(buf, "\n");
    while (line != NULL) {
        read_swift_value(line, SWIFT_STORE[0], &stats.requests);
        read_swift_value(line, SWIFT_STORE[1], &stats.bytes_in);
        read_swift_value(line, SWIFT_STORE[2], &stats.bytes_out);
        read_swift_value(line, SWIFT_STORE[3], &stats.objs);
        /*Average HTTP respone time:      5min: 11.70 ms, 60min: 10.06 ms*/
        if (strstr(line, "Average HTTP respone time") != NULL) {
            float a, b;
            sscanf(line, "        Average HTTP respone time:      5min: %f ms, 60min: %f ms", &a, &b);
            stats.rt = a * 1000;
        }
        /* Request Hit Ratios:     5min: 95.8%, 60min: 95.7% */
        if (strstr(line, "Request Hit Ratios") != NULL) {
            float a, b;
            sscanf(line, "        Request Hit Ratios:     5min: %f%%, 60min: %f%%", &a, &b);
            stats.r_hit = a * 1000;
        }
        /* Byte Hit Ratios:        5min: 96.6%, 60min: 96.6% */
        if (strstr(line, "Byte Hit Ratios") != NULL) {
            float a, b;
            sscanf(line, "        Byte Hit Ratios:        5min: %f%%, 60min: %f%%", &a, &b);
            stats.b_hit = a * 1000;
        }
        /* UP Time:        247256.904 seconds */
        if (strstr(line, "UP Time") != NULL) {
            float a;
            sscanf(line, "        UP Time:        %f seconds", &a);
            stats.t_cpu = a * 1000;
        }
        /* CPU Time:       23487.042 seconds */
        if (strstr(line, "CPU Time") != NULL) {
            float a;
            sscanf(line, "        CPU Time:       %f seconds", &a);
            stats.s_cpu = a * 1000;
        }
        line = strtok(NULL, "\n");
    }
    return 0;
}
Beispiel #3
0
int
parse_swift_info(char *buf)
{
    char *line;
    line = strtok(buf, "\n");
    while (line != NULL) {
        read_swift_value(line, SWIFT_STORE[0], &stats.requests);
        read_swift_value(line, SWIFT_STORE[1], &stats.bytes_in);
        read_swift_value(line, SWIFT_STORE[2], &stats.bytes_out);
        read_swift_value(line, SWIFT_STORE[3], &stats.total_svc_time);
        read_swift_value(line, SWIFT_STORE[4], &stats.hits);
        read_swift_value(line, SWIFT_STORE[5], &stats.objs);
        read_swift_value(line, SWIFT_STORE[6], &stats.clients);
        read_swift_value(line, SWIFT_STORE[7], &stats.accepts);
        read_swift_value(line, SWIFT_STORE[8], &stats.conns);
        read_swift_value(line, SWIFT_STORE[9], &stats.s_bytes_in);
        /* Byte Hit Ratios:        5min: 96.6%, 60min: 96.6% */
        if (strstr(line, "Byte Hit Ratios") != NULL) {
            float a, b;
            sscanf(line, "        Byte Hit Ratios:        5min: %f%%, 60min: %f%%", &a, &b);
            if (a > 0)
                stats.b_hit = a * 1000;
            else
                stats.b_hit = 0;
        }
        /* UP Time:        247256.904 seconds */
        if (strstr(line, "UP Time") != NULL) {
            float a;
            sscanf(line, "        UP Time:        %f seconds", &a);
            stats.t_cpu = a * 1000;
        }
        /* CPU Time:       23487.042 seconds */
        if (strstr(line, "CPU Time") != NULL) {
            float a;
            sscanf(line, "        CPU Time:       %f seconds", &a);
            stats.s_cpu = a * 1000;
        }
        line = strtok(NULL, "\n");
    }
    return 0;
}