From 5eecb4c8be1669dd1be8898adb9705969714b0d3 Mon Sep 17 00:00:00 2001 From: tibvdm Date: Tue, 18 Jun 2024 18:11:41 +0200 Subject: [PATCH] basic timing pept2data --- app/controllers/mpa/pept2data_controller.rb | 9 +++++++++ app/views/mpa/pept2data/pept2data.json.jbuilder | 1 + 2 files changed, 10 insertions(+) diff --git a/app/controllers/mpa/pept2data_controller.rb b/app/controllers/mpa/pept2data_controller.rb index a281cf6..4dbce6a 100644 --- a/app/controllers/mpa/pept2data_controller.rb +++ b/app/controllers/mpa/pept2data_controller.rb @@ -1,7 +1,13 @@ class Mpa::Pept2dataController < Mpa::MpaController include SuffixArrayHelper + def get_time + Process.clock_gettime(Process::CLOCK_MONOTONIC, :millisecond) + end + def pept2data + start = get_time + peptides = params[:peptides] || [] missed = params[:missed].nil? ? false : params[:missed] equate_il = params[:equate_il].nil? ? true : params[:equate_il] @@ -26,5 +32,8 @@ def pept2data Lineage.find(taxa).each do |lineage| @lineages[lineage.taxon_id] = lineage.to_a_idx end + + @timings = Hash.new + @timings["total"] = get_time - start end end diff --git a/app/views/mpa/pept2data/pept2data.json.jbuilder b/app/views/mpa/pept2data/pept2data.json.jbuilder index 12abf2a..1191d0f 100644 --- a/app/views/mpa/pept2data/pept2data.json.jbuilder +++ b/app/views/mpa/pept2data/pept2data.json.jbuilder @@ -7,3 +7,4 @@ json.peptides @response do |peptide| json.data peptide["fa"]["data"] end end +json.timings @timings