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;
}
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;
}
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;
}
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;
}
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);
}
Aggregations