Everything we do with ExpressionEngine leads to output of some form. Ever wondered exactly what is happening to transform our raw templates into fully assembled HTML? We look at exactly what’s happening under the hood, from the top of the stack fetching raw templates, pulling and parsing data, right down through all the execution layers to the bare metal. To do this we go through the existing tools we’ve got to help us, and introduce a new one that exposes EE’s inner workings in ways never before seen.
The EE Engine
User -> EE (talks to the DB) -> Outputs the website
Parts of EE
All of them talk to the database.
CodeIngnitor - PHP Framework that EE is built on.
Core consists of:
- channel model
- entries model
- template model
- 1st and 3rd party
- site itself
Around 8000 files make up the core.
- Woodcutter Simulator (Check it out online, YouTube Videos)
- Conflict Setting
- Lives at the top
- Mainly used for the DB list, to see queries
- Shows query and how long it took.
- "Start the timer… Tick Tock Tick Tock…"
- Once the profiler is run there is no way to tell why the queries are being run.
- Lives at the bottom
- Elapsed Time
- Relative Execution Time
- Memory Usage
- Freeform text message
- (implied execution order)
Caveat! - Logging points are optional
Graphite - Add-on that turns a template log into a graph. http://devot-ee.com/add-ons/jb-graphite
Logs are great for add-ons that do external requests (Facebook, Twitter, etc.) to see how long they are taking. - Chat Room Comment
Problem with template logging: It's internal to the system.
Must go beyond the Output Profiler and Template Logging
XDebug - a php extension: http://xdebug.org/ Takes a standard error display which is obtuse and bland and makes it more readable, adding the cause tag.
Webgrind Webgrind is an Xdebug profiling web frontend in PHP5. It implements a subset of the features of kcachegrind and installs in seconds and works on all platforms. For quick'n'dirty optimizations it does the job. http://code.google.com/p/webgrind/