Search in sources :

Example 86 with StopWatch

use of org.apache.commons.lang3.time.StopWatch in project Gemma by PavlidisLab.

the class ExpressionExperimentController method showExpressionExperiment.

@RequestMapping({ "/showExpressionExperiment.html", "/", "/show" })
public ModelAndView showExpressionExperiment(HttpServletRequest request, HttpServletResponse response) {
    StopWatch timer = new StopWatch();
    timer.start();
    ModelAndView mav = new ModelAndView("expressionExperiment.detail");
    BioAssaySet expExp = this.getExpressionExperimentFromRequest(request);
    mav.addObject("expressionExperiment", expExp);
    mav.addObject("eeId", expExp.getId());
    mav.addObject("eeClass", ExpressionExperiment.class.getName());
    if (timer.getTime() > 200) {
        ExpressionExperimentController.log.info("Show Experiment was slow: id=" + expExp.getId() + " " + timer.getTime() + "ms");
    }
    return mav;
}
Also used : ModelAndView(org.springframework.web.servlet.ModelAndView) StopWatch(org.apache.commons.lang3.time.StopWatch) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 87 with StopWatch

use of org.apache.commons.lang3.time.StopWatch in project Gemma by PavlidisLab.

the class ExpressionExperimentController method loadStatusSummaries.

/**
 * AJAX. Data summarizing the status of experiments.
 *
 * @param taxonId    can be null
 * @param limit      If >0, get the most recently updated N experiments, where N <= limit; or if < 0, get the least
 *                   recently updated; if 0, or null, return all.
 * @param filter     if non-null, limit data sets to ones meeting criteria.
 * @param showPublic return user's public datasets too
 * @return ee details vos
 */
public Collection<ExpressionExperimentDetailsValueObject> loadStatusSummaries(Long taxonId, List<Long> ids, Integer limit, Integer filter, Boolean showPublic) {
    StopWatch timer = new StopWatch();
    timer.start();
    Collection<ExpressionExperimentDetailsValueObject> vos;
    if (!SecurityUtil.isUserLoggedIn()) {
        throw new AccessDeniedException("User does not have access to experiment management");
    }
    if (limit == null) {
        limit = 50;
    }
    vos = this.getEEVOsForManager(taxonId, ids, limit, filter, showPublic);
    if (vos.isEmpty()) {
        return new HashSet<>();
    }
    if (timer.getTime() > 1000) {
        ExpressionExperimentController.log.info("Fetching basic data took: " + timer.getTime() + "ms");
    }
    timer.reset();
    timer.start();
    expressionExperimentReportService.getAnnotationInformation(vos);
    expressionExperimentReportService.populateEventInformation(vos);
    if (timer.getTime() > 1000) {
        ExpressionExperimentController.log.info("Filling in report data for " + vos.size() + " EEs: " + timer.getTime() + "ms");
    }
    // We need to convert the VOs to detailVos and add array designs so trouble info can be correctly displayed.
    for (ExpressionExperimentDetailsValueObject vo : vos) {
        vo.setArrayDesigns(arrayDesignService.loadValueObjectsForEE(vo.getId()));
    }
    return vos;
}
Also used : AccessDeniedException(org.springframework.security.access.AccessDeniedException) StopWatch(org.apache.commons.lang3.time.StopWatch)

Example 88 with StopWatch

use of org.apache.commons.lang3.time.StopWatch in project Gemma by PavlidisLab.

the class ExpressionExperimentSetController method showExpressionExperimentSet.

@RequestMapping(value = "/showExpressionExperimentSet.html", method = RequestMethod.GET)
public ModelAndView showExpressionExperimentSet(HttpServletRequest request, HttpServletResponse response) {
    ModelAndView mav = new ModelAndView("expressionExperimentSet.detail");
    StopWatch timer = new StopWatch();
    timer.start();
    ExpressionExperimentSetValueObject eesvo = this.getExpressionExperimentSetFromRequest(request);
    mav.addObject("eeSetId", eesvo.getId());
    mav.addObject("eeSetName", eesvo.getName());
    if (timer.getTime() > 200) {
        log.info("Show experiment set was slow: id=" + eesvo.getId() + " " + timer.getTime() + "ms");
    }
    return mav;
}
Also used : SessionBoundExpressionExperimentSetValueObject(ubic.gemma.model.expression.experiment.SessionBoundExpressionExperimentSetValueObject) ExpressionExperimentSetValueObject(ubic.gemma.model.expression.experiment.ExpressionExperimentSetValueObject) ModelAndView(org.springframework.web.servlet.ModelAndView) StopWatch(org.apache.commons.lang3.time.StopWatch) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 89 with StopWatch

use of org.apache.commons.lang3.time.StopWatch in project Gemma by PavlidisLab.

the class GeneController method handleRequestInternal.

@RequestMapping("/downloadGeneList.html")
protected ModelAndView handleRequestInternal(HttpServletRequest request) {
    StopWatch watch = new StopWatch();
    watch.start();
    // might not be any
    Collection<Long> geneIds = ControllerUtils.extractIds(request.getParameter("g"));
    // might not be there
    Collection<Long> geneSetIds = ControllerUtils.extractIds(request.getParameter("gs"));
    // might not be there
    String geneSetName = request.getParameter("gsn");
    ModelAndView mav = new ModelAndView(new TextView());
    if ((geneIds == null || geneIds.isEmpty()) && (geneSetIds == null || geneSetIds.isEmpty())) {
        mav.addObject("text", "Could not find genes to match gene ids: {" + geneIds + "} or gene set ids {" + geneSetIds + "}");
        return mav;
    }
    Collection<GeneValueObject> genes = new ArrayList<>();
    if (geneIds != null) {
        for (Long id : geneIds) {
            genes.add(geneService.loadValueObjectById(id));
        }
    }
    if (geneSetIds != null) {
        for (Long id : geneSetIds) {
            genes.addAll(geneSetService.getGenesInGroup(new GeneSetValueObject(id)));
        }
    }
    mav.addObject("text", format4File(genes, geneSetName));
    watch.stop();
    Long time = watch.getTime();
    if (time > 100) {
        log.info("Retrieved and Formated" + genes.size() + " genes in : " + time + " ms.");
    }
    return mav;
}
Also used : GeneValueObject(ubic.gemma.model.genome.gene.GeneValueObject) ModelAndView(org.springframework.web.servlet.ModelAndView) TextView(ubic.gemma.web.view.TextView) StopWatch(org.apache.commons.lang3.time.StopWatch) GeneSetValueObject(ubic.gemma.model.genome.gene.GeneSetValueObject) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Example 90 with StopWatch

use of org.apache.commons.lang3.time.StopWatch in project nd4j by deeplearning4j.

the class BinarySerdeTest method timeOldVsNew.

@Test
public void timeOldVsNew() throws Exception {
    int numTrials = 1000;
    long oldTotal = 0;
    long newTotal = 0;
    INDArray arr = Nd4j.create(100000);
    Nd4j.getCompressor().compressi(arr, "GZIP");
    for (int i = 0; i < numTrials; i++) {
        StopWatch oldStopWatch = new StopWatch();
        BufferedOutputStream bos = new BufferedOutputStream(new ByteArrayOutputStream(arr.length()));
        DataOutputStream dos = new DataOutputStream(bos);
        oldStopWatch.start();
        Nd4j.write(arr, dos);
        oldStopWatch.stop();
        // System.out.println("Old " + oldStopWatch.getNanoTime());
        oldTotal += oldStopWatch.getNanoTime();
        StopWatch newStopWatch = new StopWatch();
        newStopWatch.start();
        BinarySerde.toByteBuffer(arr);
        newStopWatch.stop();
        // System.out.println("New " + newStopWatch.getNanoTime());
        newTotal += newStopWatch.getNanoTime();
    }
    oldTotal /= numTrials;
    newTotal /= numTrials;
    System.out.println("Old avg " + oldTotal + " New avg " + newTotal);
}
Also used : INDArray(org.nd4j.linalg.api.ndarray.INDArray) DataOutputStream(java.io.DataOutputStream) ByteArrayOutputStream(java.io.ByteArrayOutputStream) BufferedOutputStream(java.io.BufferedOutputStream) StopWatch(org.apache.commons.lang3.time.StopWatch) Test(org.junit.Test)

Aggregations

StopWatch (org.apache.commons.lang3.time.StopWatch)528 Test (org.junit.Test)150 EventResult (org.alfresco.bm.event.EventResult)97 DBObject (com.mongodb.DBObject)90 Event (org.alfresco.bm.event.Event)87 FolderData (org.alfresco.bm.cm.FolderData)75 File (java.io.File)71 ArrayList (java.util.ArrayList)49 HashSet (java.util.HashSet)31 Gene (ubic.gemma.model.genome.Gene)31 Vertex (org.apache.tinkerpop.gremlin.structure.Vertex)26 BaseTest (org.umlg.sqlg.test.BaseTest)26 Element (org.w3c.dom.Element)25 IOException (java.io.IOException)23 LoadSingleComponentUnitTest (org.alfresco.bm.dataload.LoadSingleComponentUnitTest)23 UserModel (org.alfresco.utility.model.UserModel)23 Collectors (java.util.stream.Collectors)19 HashMap (java.util.HashMap)18 List (java.util.List)18 ExpressionExperiment (ubic.gemma.model.expression.experiment.ExpressionExperiment)18