Search in sources :

Example 6 with DebugEntryTemplate

use of lucee.runtime.debug.DebugEntryTemplate in project Lucee by lucee.

the class ComponentLoader method loadPage.

public static Page loadPage(PageContext pc, PageSource ps, boolean forceReload) throws PageException {
    if (pc.getConfig().debug()) {
        DebugEntryTemplate debugEntry = pc.getDebugger().getEntry(pc, ps);
        pc.addPageSource(ps, true);
        long currTime = pc.getExecutionTime();
        long exeTime = 0;
        long time = System.currentTimeMillis();
        try {
            debugEntry.updateFileLoadTime((int) (System.currentTimeMillis() - time));
            exeTime = System.currentTimeMillis();
            return ps.loadPage(pc, forceReload);
        } finally {
            long diff = ((System.currentTimeMillis() - exeTime) - (pc.getExecutionTime() - currTime));
            pc.setExecutionTime(pc.getExecutionTime() + (System.currentTimeMillis() - time));
            debugEntry.updateExeTime(diff);
            pc.removeLastPageSource(true);
        }
    }
    // no debug
    pc.addPageSource(ps, true);
    try {
        return ps.loadPage(pc, forceReload);
    } finally {
        pc.removeLastPageSource(true);
    }
}
Also used : DebugEntryTemplate(lucee.runtime.debug.DebugEntryTemplate)

Aggregations

DebugEntryTemplate (lucee.runtime.debug.DebugEntryTemplate)6 Variables (lucee.runtime.type.scope.Variables)2 ComponentImpl (lucee.runtime.ComponentImpl)1 InterfaceImpl (lucee.runtime.InterfaceImpl)1 ErrorPage (lucee.runtime.err.ErrorPage)1 PageException (lucee.runtime.exp.PageException)1