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

one.xingyi.profile.IProfile Maven / Gradle / Ivy

package one.xingyi.profile;

import lombok.var;
import one.xingyi.interfaces.INanoTime;
import one.xingyi.interfaces.RunnableWithExceptionE;
import one.xingyi.interfaces.SupplierWithExceptionE;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.function.Supplier;

interface IProfileControl {
    void clear();
}

interface IProfileDetailedInfo {
    static IProfileDetailedInfo from(IProfile p) {
        if (p instanceof ProfileImpl) return (IProfileDetailedInfo) p;
        throw new IllegalArgumentException("Can only get detailed info from a ProfileImpl. Was " + p.getClass().getName());
    }

    Map> getMs();

    Map> getCounts();

    Map getTotalCounts();

    Map getTotalAvg();
}

public interface IProfile {
    static IProfileBuilder makeProfileMap(INanoTime nanoTime) {
        return new ProfileImpl("", new ConcurrentHashMap<>(), nanoTime);
    }

    IProfileInfo mainProfileInfo();

    String print();

     T profileE(String name, SupplierWithExceptionE fn) throws E;

     T profile(String name, Supplier fn);

    void run(String name, Runnable fn);


     void runE(String name, RunnableWithExceptionE fn) throws E;

    void add(String name, long duration);


}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy