All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.hyperfoil.tools.parse.factory.WrkFactory Maven / Gradle / Ivy

There is a newer version: 0.2.2
Show newest version
package io.hyperfoil.tools.parse.factory;

import io.hyperfoil.tools.parse.*;

/**
 * Created by johara
 * WrkFactory - creates a Parser for wrk/wrk2 logs
 */
public class WrkFactory implements ParseFactory {

    public Exp connections() { return new Exp("connections", "\\s+(?\\d*)\\sthreads and\\s*(?\\d*)\\s+connections"); }

    public Exp testConfig() { return new Exp("config", "Running (?\\d*)(?\\w*)\\stest @ (?.*)"); }

    public Exp reqSec() {
        return new Exp("reqSec", "Requests/sec:\\s+(?\\d*\\.\\d*)");
    }

    public Exp latency() { return new Exp("latency", "\\s*Latency\\s*(?\\d*\\.\\d*)(?\\w*)\\s*(?\\d*\\.\\d*)(?\\w*)\\s*(?\\d*\\.\\d*)(?\\w*)\\s*(?\\d*\\.\\d*)"); }

    public Exp latencyDistribution() { return new Exp("latencyDistribution", "^\\s*(?\\d*\\.\\d*)%\\s*(?\\d*\\.\\d*)(?\\w*)\\s*.*"); }

    @Override
    public Parser newParser() {
        Parser p = new Parser();
        addToParser(p);
        return p;
    }

    @Override
    public void addToParser(Parser p) {
        p.add(testConfig().addRule(ExpRule.PreClose));
        p.add(connections());
        p.add(latency());
        p.add(reqSec());
        p.add(latencyDistribution().nest("latencyDistribution").setMerge(ExpMerge.AsEntry));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy