diff --git a/src/main/java/caosdb/server/query/Query.java b/src/main/java/caosdb/server/query/Query.java index c9bff5a5f11aa5775582c613d80062419f9adb4c..d3e0e927d14d0b2021f056ad52f10df548c5734c 100644 --- a/src/main/java/caosdb/server/query/Query.java +++ b/src/main/java/caosdb/server/query/Query.java @@ -415,6 +415,7 @@ public class Query implements QueryInterface, ToElementable, TransactionInterfac } public void parse() throws ParsingException { + final long t1 = System.currentTimeMillis(); CQLLexer lexer; lexer = new CQLLexer(CharStreams.fromString(this.query)); final CommonTokenStream tokens = new CommonTokenStream(lexer); @@ -434,6 +435,8 @@ public class Query implements QueryInterface, ToElementable, TransactionInterfac this.type = cq.t; this.filter = cq.filter; this.selections = cq.s; + final long t2 = System.currentTimeMillis(); + addBenchmark("parse (" + this.query + ")", t2 - t1); } private String executeStrategy() throws QueryException { diff --git a/src/main/java/caosdb/server/resource/ScriptingResource.java b/src/main/java/caosdb/server/resource/ScriptingResource.java index 43e11cf6fe98d76dcfd0e322573cce34634fa8ce..d82df5c7443c72ea168ded9483cb374a1f6e5f0b 100644 --- a/src/main/java/caosdb/server/resource/ScriptingResource.java +++ b/src/main/java/caosdb/server/resource/ScriptingResource.java @@ -83,7 +83,7 @@ public class ScriptingResource extends AbstractCaosDBServerResource { @Override protected Representation httpPostInChildClass(Representation entity) throws Exception { - if(isAnonymous()) { + if (isAnonymous()) { throw ServerMessages.AUTHORIZATION_ERROR; } MediaType mediaType = entity.getMediaType(); @@ -205,12 +205,12 @@ public class ScriptingResource extends AbstractCaosDBServerResource { public Object generateAuthToken() { return SessionToken.generate((Principal) getUser().getPrincipal(), null); } - + boolean isAnonymous() { boolean ret = getUser().hasRole(UserSources.ANONYMOUS_ROLE); return ret; } - + public int callScript( List<String> commandLine, Integer timeoutMs, List<FileProperties> files, Object authToken) throws Message { diff --git a/src/main/java/caosdb/server/resource/transaction/EntityResource.java b/src/main/java/caosdb/server/resource/transaction/EntityResource.java index 0e78c46a1f20fd870aca972f5c272c38c78438d0..f55c2b7ae0cb736305086ae131c3a3eeac1ba0ab 100644 --- a/src/main/java/caosdb/server/resource/transaction/EntityResource.java +++ b/src/main/java/caosdb/server/resource/transaction/EntityResource.java @@ -99,6 +99,7 @@ public class EntityResource extends AbstractCaosDBServerResource { throws ConnectionException, IOException, SQLException, CaosDBException, NoSuchAlgorithmException, Exception { + final long t1 = System.currentTimeMillis(); if (!this.get) { getResponse().setStatus(Status.CLIENT_ERROR_METHOD_NOT_ALLOWED); return null; @@ -112,6 +113,10 @@ public class EntityResource extends AbstractCaosDBServerResource { final Retrieve retrieve = new Retrieve(entityContainer); retrieve.execute(); + final long t2 = System.currentTimeMillis(); + entityContainer + .getTransactionBenchmark() + .addBenchmark(getClass().getSimpleName() + ".httpGetInChildClass", t2 - t1); final Element rootElem = generateRootElement(); entityContainer.addToElement(rootElem); doc.setRootElement(rootElem); diff --git a/src/test/java/caosdb/server/scripting/TestServerSideScriptingCaller.java b/src/test/java/caosdb/server/scripting/TestServerSideScriptingCaller.java index e66c646a4e5604f2b7df2dac0af689aa8797160a..f752c29c2f99b33d30a75ff3e09c7043c92fc464 100644 --- a/src/test/java/caosdb/server/scripting/TestServerSideScriptingCaller.java +++ b/src/test/java/caosdb/server/scripting/TestServerSideScriptingCaller.java @@ -613,9 +613,7 @@ public class TestServerSideScriptingCaller extends CaosDBTestClass { caller.cleanup(); } -/** - * Does the order of directory creation matter? - */ + /** Does the order of directory creation matter? */ @Test public void testDirectoriesInWrongOrder() throws Message { final String[] cmd = {testExecutable.getAbsolutePath()}; @@ -645,9 +643,7 @@ public class TestServerSideScriptingCaller extends CaosDBTestClass { caller.cleanup(); } - /** - * Is the new home directory created correctly? - */ + /** Is the new home directory created correctly? */ @Test public void testWorkingDirCreation() throws Exception { final String[] cmd = {testExecutable.getAbsolutePath()}; @@ -660,9 +656,7 @@ public class TestServerSideScriptingCaller extends CaosDBTestClass { caller.cleanup(); } - /** - * Does copying files over to the new home directory work? - */ + /** Does copying files over to the new home directory work? */ @Test public void testWorkingDirCopying() throws Exception { final String[] cmd = {testExecutable.getAbsolutePath()};