Search in sources :

Example 1 with DebugEntryTemplate

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

the class PageContextImpl method _doInclude.

private void _doInclude(PageSource[] sources, boolean runOnce) throws PageException {
    // debug
    if (!gatewayContext && config.debug()) {
        long currTime = executionTime;
        long exeTime = 0;
        long time = System.nanoTime();
        Page currentPage = PageSourceImpl.loadPage(this, sources);
        notSupported(config, currentPage.getPageSource());
        if (runOnce && includeOnce.contains(currentPage.getPageSource()))
            return;
        DebugEntryTemplate debugEntry = debugger.getEntry(this, currentPage.getPageSource());
        try {
            addPageSource(currentPage.getPageSource(), true);
            debugEntry.updateFileLoadTime((System.nanoTime() - time));
            exeTime = System.nanoTime();
            currentPage.call(this);
        } catch (Throwable t) {
            ExceptionUtil.rethrowIfNecessary(t);
            PageException pe = Caster.toPageException(t);
            if (Abort.isAbort(pe)) {
                if (Abort.isAbort(pe, Abort.SCOPE_REQUEST))
                    throw pe;
            } else {
                if (fdEnabled) {
                    FDSignal.signal(pe, false);
                }
                // TODO was soll das 187
                pe.addContext(currentPage.getPageSource(), -187, -187, null);
                throw pe;
            }
        } finally {
            includeOnce.add(currentPage.getPageSource());
            long diff = ((System.nanoTime() - exeTime) - (executionTime - currTime));
            executionTime += (System.nanoTime() - time);
            debugEntry.updateExeTime(diff);
            removeLastPageSource(true);
        }
    } else // no debug
    {
        Page currentPage = PageSourceImpl.loadPage(this, sources);
        notSupported(config, currentPage.getPageSource());
        if (runOnce && includeOnce.contains(currentPage.getPageSource()))
            return;
        try {
            addPageSource(currentPage.getPageSource(), true);
            currentPage.call(this);
        } catch (Throwable t) {
            ExceptionUtil.rethrowIfNecessary(t);
            PageException pe = Caster.toPageException(t);
            if (Abort.isAbort(pe)) {
                if (Abort.isAbort(pe, Abort.SCOPE_REQUEST))
                    throw pe;
            } else {
                pe.addContext(currentPage.getPageSource(), -187, -187, null);
                throw pe;
            }
        } finally {
            includeOnce.add(currentPage.getPageSource());
            removeLastPageSource(true);
        }
    }
}
Also used : DebugEntryTemplate(lucee.runtime.debug.DebugEntryTemplate) PageException(lucee.runtime.exp.PageException) ErrorPage(lucee.runtime.err.ErrorPage)

Example 2 with DebugEntryTemplate

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

the class ComponentImpl method _call.

Object _call(PageContext pc, Collection.Key calledName, UDFPlus udf, Struct namedArgs, Object[] args) throws PageException {
    Object rtn = null;
    Variables parent = null;
    // debug yes
    if (pc.getConfig().debug()) {
        // new DebugEntry(src,udf.getFunctionName());
        DebugEntryTemplate debugEntry = pc.getDebugger().getEntry(pc, pageSource, udf.getFunctionName());
        long currTime = pc.getExecutionTime();
        long time = System.nanoTime();
        // sync yes
        if (top.properties._synchronized) {
            synchronized (this) {
                try {
                    parent = beforeCall(pc);
                    if (args != null)
                        rtn = udf.call(pc, calledName, args, true);
                    else
                        rtn = udf.callWithNamedValues(pc, calledName, namedArgs, true);
                } finally {
                    pc.setVariablesScope(parent);
                    long diff = ((System.nanoTime() - time) - (pc.getExecutionTime() - currTime));
                    pc.setExecutionTime(pc.getExecutionTime() + diff);
                    debugEntry.updateExeTime(diff);
                }
            }
        } else // sync no
        {
            try {
                parent = beforeCall(pc);
                if (args != null)
                    rtn = udf.call(pc, calledName, args, true);
                else
                    rtn = udf.callWithNamedValues(pc, calledName, namedArgs, true);
            } finally {
                pc.setVariablesScope(parent);
                long diff = ((System.nanoTime() - time) - (pc.getExecutionTime() - currTime));
                pc.setExecutionTime(pc.getExecutionTime() + diff);
                debugEntry.updateExeTime(diff);
            }
        }
    } else // debug no
    {
        // sync yes
        if (top.properties._synchronized) {
            synchronized (this) {
                try {
                    parent = beforeCall(pc);
                    if (args != null)
                        rtn = udf.call(pc, calledName, args, true);
                    else
                        rtn = udf.callWithNamedValues(pc, calledName, namedArgs, true);
                } finally {
                    pc.setVariablesScope(parent);
                }
            }
        } else // sync no 385|263
        {
            try {
                parent = beforeCall(pc);
                if (args != null)
                    rtn = udf.call(pc, calledName, args, true);
                else
                    rtn = udf.callWithNamedValues(pc, calledName, namedArgs, true);
            } finally {
                pc.setVariablesScope(parent);
            }
        }
    }
    return rtn;
}
Also used : Variables(lucee.runtime.type.scope.Variables) DebugEntryTemplate(lucee.runtime.debug.DebugEntryTemplate)

Example 3 with DebugEntryTemplate

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

the class StaticScope method _call.

Object _call(PageContext pc, Collection.Key calledName, UDFPlus udf, Struct namedArgs, Object[] args) throws PageException {
    Object rtn = null;
    Variables parent = null;
    // debug yes
    if (pc.getConfig().debug()) {
        // new DebugEntry(src,udf.getFunctionName());
        DebugEntryTemplate debugEntry = pc.getDebugger().getEntry(pc, cp.getPageSource(), udf.getFunctionName());
        long currTime = pc.getExecutionTime();
        long time = System.nanoTime();
        // sync yes
        if (c.top.properties._synchronized) {
            synchronized (this) {
                try {
                    parent = c.beforeStaticConstructor(pc);
                    if (args != null)
                        rtn = udf.call(pc, calledName, args, true);
                    else
                        rtn = udf.callWithNamedValues(pc, calledName, namedArgs, true);
                } finally {
                    c.afterStaticConstructor(pc, parent);
                    long diff = ((System.nanoTime() - time) - (pc.getExecutionTime() - currTime));
                    pc.setExecutionTime(pc.getExecutionTime() + diff);
                    debugEntry.updateExeTime(diff);
                }
            }
        } else // sync no
        {
            try {
                parent = c.beforeStaticConstructor(pc);
                if (args != null)
                    rtn = udf.call(pc, calledName, args, true);
                else
                    rtn = udf.callWithNamedValues(pc, calledName, namedArgs, true);
            } finally {
                c.afterStaticConstructor(pc, parent);
                long diff = ((System.nanoTime() - time) - (pc.getExecutionTime() - currTime));
                pc.setExecutionTime(pc.getExecutionTime() + diff);
                debugEntry.updateExeTime(diff);
            }
        }
    } else // debug no
    {
        // sync yes
        if (c.top.properties._synchronized) {
            synchronized (this) {
                try {
                    parent = c.beforeStaticConstructor(pc);
                    if (args != null)
                        rtn = udf.call(pc, calledName, args, true);
                    else
                        rtn = udf.callWithNamedValues(pc, calledName, namedArgs, true);
                } finally {
                    c.afterStaticConstructor(pc, parent);
                }
            }
        } else {
            try {
                parent = c.beforeStaticConstructor(pc);
                if (args != null)
                    rtn = udf.call(pc, calledName, args, true);
                else
                    rtn = udf.callWithNamedValues(pc, calledName, namedArgs, true);
            } finally {
                c.afterStaticConstructor(pc, parent);
            }
        }
    }
    return rtn;
}
Also used : Variables(lucee.runtime.type.scope.Variables) DebugEntryTemplate(lucee.runtime.debug.DebugEntryTemplate)

Example 4 with DebugEntryTemplate

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

the class ComponentLoader method _loadComponent.

private static ComponentImpl _loadComponent(PageContext pc, CIPage page, String callPath, boolean isRealPath, final boolean isExtendedComponent, boolean executeConstr) throws PageException {
    ComponentImpl rtn = null;
    if (pc.getConfig().debug()) {
        DebugEntryTemplate debugEntry = pc.getDebugger().getEntry(pc, page.getPageSource());
        pc.addPageSource(page.getPageSource(), true);
        long currTime = pc.getExecutionTime();
        long exeTime = 0;
        long time = System.nanoTime();
        try {
            debugEntry.updateFileLoadTime((int) (System.nanoTime() - time));
            exeTime = System.nanoTime();
            rtn = initComponent(pc, page, callPath, isRealPath, isExtendedComponent, executeConstr);
        } finally {
            if (rtn != null)
                rtn.setLoaded(true);
            long diff = ((System.nanoTime() - exeTime) - (pc.getExecutionTime() - currTime));
            pc.setExecutionTime(pc.getExecutionTime() + (System.nanoTime() - time));
            debugEntry.updateExeTime(diff);
            pc.removeLastPageSource(true);
        }
    } else // no debug
    {
        pc.addPageSource(page.getPageSource(), true);
        try {
            rtn = initComponent(pc, page, callPath, isRealPath, isExtendedComponent, executeConstr);
        } finally {
            if (rtn != null)
                rtn.setLoaded(true);
            pc.removeLastPageSource(true);
        }
    }
    return rtn;
}
Also used : DebugEntryTemplate(lucee.runtime.debug.DebugEntryTemplate) ComponentImpl(lucee.runtime.ComponentImpl)

Example 5 with DebugEntryTemplate

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

the class ComponentLoader method loadInterface.

public static InterfaceImpl loadInterface(PageContext pc, Page page, PageSource ps, String callPath, boolean isRealPath) throws PageException {
    InterfaceImpl rtn = null;
    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.nanoTime();
        try {
            debugEntry.updateFileLoadTime((int) (System.nanoTime() - time));
            exeTime = System.nanoTime();
            if (page == null)
                page = ps.loadPage(pc, false);
            rtn = initInterface(pc, page, callPath, isRealPath);
        } finally {
            long diff = ((System.nanoTime() - exeTime) - (pc.getExecutionTime() - currTime));
            pc.setExecutionTime(pc.getExecutionTime() + (System.nanoTime() - time));
            debugEntry.updateExeTime(diff);
            pc.removeLastPageSource(true);
        }
    } else // no debug
    {
        pc.addPageSource(ps, true);
        try {
            if (page == null)
                page = ps.loadPage(pc, false);
            rtn = initInterface(pc, page, callPath, isRealPath);
        } finally {
            pc.removeLastPageSource(true);
        }
    }
    return rtn;
}
Also used : DebugEntryTemplate(lucee.runtime.debug.DebugEntryTemplate) InterfaceImpl(lucee.runtime.InterfaceImpl)

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