/** Returns the number of seconds since the last time timerString was called * @return The number of seconds since the last time timerString was called */ public double secondsSinceLast() { return ((double) timeSinceLast()) / 1000.0; }
/** Creates a string with information including the passed message, the last passed message and the time since the last call, and the time since the beginning * @param message A message to put into the timer String * @return A String with the timing information, the timer String */ public String timerString(String message) { return timerString(message, null); }
/** Creates a string with information including the passed message, the last passed message and the time since the last call, and the time since the beginning * @param message A message to put into the timer String * @param module The debug/log module/thread to use, can be null for root module * @return A String with the timing information, the timer String */ public String timerString(String message, String module) { // time this call to avoid it interfering with the main timer long tsStart = System.currentTimeMillis(); String retString = "[[" + message + "- total:" + secondsSinceStart() + ",since last(" + ((lastMessage.length() > 20) ? (lastMessage.substring(0, 17) + "...") : lastMessage) + "):" + secondsSinceLast() + "]]"; lastMessage = message; if (log) Debug.log(Debug.TIMING, null, retString, module, "org.ofbiz.core.util.UtilTimer"); // have lastMessageTime come as late as possible to just time what happens between calls lastMessageTime = System.currentTimeMillis(); // update startTime to disclude the time this call took startTime += (lastMessageTime - tsStart); return retString; }
groupNames = new TreeSet(); UtilTimer utilTimer = new UtilTimer(); utilTimer.timerString("[ModelGroupReader.getGroupCache] Before start of entity loop"); do { if (curChild.getNodeType() == Node.ELEMENT_NODE && "entity-group".equals(curChild.getNodeName())) { } else Debug.logWarning("[ModelGroupReader.getGroupCache] No child nodes found."); utilTimer.timerString("[ModelGroupReader.getGroupCache] FINISHED - Total Entity-Groups: " + i + " FINISHED");
public void checkDb(Map modelEntities, Collection messages, boolean addMissing) { UtilTimer timer = new UtilTimer(); timer.timerString("Start - Before Get Database Meta Data"); return; timer.timerString("After Get All Table Names"); return; timer.timerString("After Get All Column Info"); timer.timerString("Before Individual Table/Column Check"); String entMessage = "(" + timer.timeSinceLast() + "ms) NOT Checking #" + curEnt + "/" + totalEnt + " View Entity " + entity.getEntityName(); String entMessage = "(" + timer.timeSinceLast() + "ms) Checking #" + curEnt + "/" + totalEnt + " Entity " + entity.getEntityName() + " with table " + entity.getTableName(datasourceInfo); timer.timerString("After Individual Table/Column Check"); timer.timerString("Finished Checking Entity Database");
String timeSinceStartStr = String.valueOf(timeSinceStart()); String timeSinceLastStr = String.valueOf(timeSinceLast());
/** Returns the number of seconds since the timer started * @return The number of seconds since the timer started */ public double secondsSinceStart() { return ((double) timeSinceStart()) / 1000.0; }
groupNames = new TreeSet<String>(); UtilTimer utilTimer = new UtilTimer(); utilTimer.timerString("[ModelGroupReader.getGroupCache] Before start of entity loop"); do { if (curChild.getNodeType() == Node.ELEMENT_NODE && "entity-group".equals(curChild.getNodeName())) { } else Debug.logWarning("[ModelGroupReader.getGroupCache] No child nodes found."); utilTimer.timerString("[ModelGroupReader.getGroupCache] FINISHED - Total Entity-Groups: " + i + " FINISHED");
public void checkDb(Map modelEntities, Collection messages, boolean addMissing) { UtilTimer timer = new UtilTimer(); timer.timerString("Start - Before Get Database Meta Data"); return; timer.timerString("After Get All Table Names"); return; timer.timerString("After Get All Column Info"); timer.timerString("Before Individual Table/Column Check"); String entMessage = "(" + timer.timeSinceLast() + "ms) NOT Checking #" + curEnt + "/" + totalEnt + " View Entity " + entity.getEntityName(); String entMessage = "(" + timer.timeSinceLast() + "ms) Checking #" + curEnt + "/" + totalEnt + " Entity " + entity.getEntityName() + " with table " + entity.getTableName(datasourceInfo); timer.timerString("After Individual Table/Column Check"); timer.timerString("Finished Checking Entity Database");
String timeSinceStartStr = String.valueOf(timeSinceStart()); String timeSinceLastStr = String.valueOf(timeSinceLast());
/** Returns the number of seconds since the timer started * @return The number of seconds since the timer started */ public double secondsSinceStart() { return ((double) timeSinceStart()) / 1000.0; }
groupNames = new TreeSet(); UtilTimer utilTimer = new UtilTimer(); utilTimer.timerString("[ModelGroupReader.getGroupCache] Before start of entity loop"); do { if (curChild.getNodeType() == Node.ELEMENT_NODE && "entity-group".equals(curChild.getNodeName())) { } else Debug.logWarning("[ModelGroupReader.getGroupCache] No child nodes found."); utilTimer.timerString("[ModelGroupReader.getGroupCache] FINISHED - Total Entity-Groups: " + i + " FINISHED");
UtilTimer timer = new UtilTimer(); timer.timerString("Start - Before Get Database metadata"); return; timer.timerString("After Get All Table Names"); return; timer.timerString("After Get All Column Info"); timer.timerString("Before Individual Table/Column Check"); verbose("(" + timer.timeSinceLast() + "ms) NOT Checking #" + curEnt + "/" + totalEnt + " View Entity " + entityName, messages); continue; String entMessage = "(" + timer.timeSinceLast() + "ms) Checking #" + curEnt + "/" + totalEnt + " Entity " + entityName + " with table " + tableName; timer.timerString("After Individual Table/Column Check"); timer.timerString("Finished Checking Entity Database");
/** Creates a string with information including the passed message, the last passed message and the time since the last call, and the time since the beginning * @param message A message to put into the timer String * @return A String with the timing information, the timer String */ public String timerString(String message) { return timerString(message, null); }
/** Returns the number of seconds since the last time timerString was called * @return The number of seconds since the last time timerString was called */ public double secondsSinceLast() { return ((double) timeSinceLast()) / 1000.0; }
/** Creates a string with information including the passed message, the last passed message and the time since the last call, and the time since the beginning * @param message A message to put into the timer String * @param module The debug/log module/thread to use, can be null for root module * @return A String with the timing information, the timer String */ public String timerString(String message, String module) { // time this call to avoid it interfering with the main timer long tsStart = System.currentTimeMillis(); String retString = "[[" + message + "- total:" + secondsSinceStart() + ",since last(" + ((lastMessage.length() > 20) ? (lastMessage.substring(0, 17) + "...") : lastMessage) + "):" + secondsSinceLast() + "]]"; lastMessage = message; if (log) Debug.log(Debug.TIMING, null, retString, module, "org.ofbiz.core.util.UtilTimer"); // have lastMessageTime come as late as possible to just time what happens between calls lastMessageTime = System.currentTimeMillis(); // update startTime to disclude the time this call took startTime += (lastMessageTime - tsStart); return retString; }
UtilTimer utilTimer = new UtilTimer(); utilTimer.timerString("Before start of field type loop"); do { if (curChild.getNodeType() == Node.ELEMENT_NODE && "field-type-def".equals(curChild.getNodeName())) { } else Debug.logWarning("No child nodes found.", module); utilTimer.timerString("FINISHED - Total Field Types: " + i + " FINISHED");
this.modelReader = reader; if (utilTimer != null) utilTimer.timerString(" createModelEntity: before general/basic info"); this.populateBasicInfo(entityElement, docElement, docElementValues); if (utilTimer != null) utilTimer.timerString(" createModelEntity: before fields"); NodeList fieldList = entityElement.getElementsByTagName("field"); if (utilTimer != null) utilTimer.timerString(" createModelEntity: before prim-keys"); NodeList pkList = entityElement.getElementsByTagName("prim-key"); if (utilTimer != null) utilTimer.timerString(" createModelEntity: before relations"); this.populateRelated(reader, entityElement); this.populateIndexes(entityElement);
UtilTimer utilTimer = new UtilTimer(); utilTimer.timerString("Before start of field type loop"); do { if (curChild.getNodeType() == Node.ELEMENT_NODE && "field-type-def".equals(curChild.getNodeName())) { } else Debug.logWarning("No child nodes found.", module); utilTimer.timerString("FINISHED - Total Field Types: " + i + " FINISHED");
this.modelReader = reader; if (utilTimer != null) utilTimer.timerString(" createModelEntity: before general/basic info"); this.populateBasicInfo(entityElement, docElement, docElementValues); if (utilTimer != null) utilTimer.timerString(" createModelEntity: before fields"); NodeList fieldList = entityElement.getElementsByTagName("field"); if (utilTimer != null) utilTimer.timerString(" createModelEntity: before prim-keys"); NodeList pkList = entityElement.getElementsByTagName("prim-key"); if (utilTimer != null) utilTimer.timerString(" createModelEntity: before relations"); this.populateRelated(reader, entityElement); this.populateIndexes(entityElement);