Enhancement - Hooks

- Added timing information for event trigger calls.
This commit is contained in:
Paul Beckingham 2010-01-30 13:25:25 -05:00
parent 98f4e22950
commit 79050c29d7

View file

@ -28,6 +28,7 @@
#include <iostream>
#include "Context.h"
#include "Hooks.h"
#include "Timer.h"
extern Context context;
@ -79,16 +80,15 @@ Hooks::~Hooks ()
}
////////////////////////////////////////////////////////////////////////////////
// Enumerate all hooks, and tell API about the script files it must load in
// order to call them. Note that API will perform a deferred read, which means
// that if it isn't called, a script will not be loaded.
void Hooks::initialize ()
{
#ifdef HAVE_LIBLUA
api.initialize ();
#endif
// TODO Enumerate all hooks, and tell API about the script files it must load
// in order to call them. Note that API will perform a deferred read,
// which means that if it isn't called, a script will not be loaded.
std::vector <std::string> vars;
context.config.all (vars);
@ -148,6 +148,8 @@ bool Hooks::trigger (const std::string& event)
{
if (it->event == event)
{
Timer timer (std::string ("Hooks::trigger ") + event);
bool rc = true;
std::string type;
if (eventType (event, type))