[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] api/core_functions.inc.php, 1.1.1.1.2.22
From: |
nomail |
Subject: |
[Phpgroupware-cvs] api/core_functions.inc.php, 1.1.1.1.2.22 |
Date: |
Sun, 23 May 2004 06:43:10 -0000 |
Update of /api
Modified Files:
Branch: proposal-branch
core_functions.inc.php
date: 2004/05/03 07:20:43; author: jengo; state: Exp; lines: +24 -10
Log Message:
Added a performance timer for each time execMethod() is called, useful for
tracking down bottlenecks
=====================================================================
Index: api/core_functions.inc.php
diff -u api/core_functions.inc.php:1.1.1.1.2.21
api/core_functions.inc.php:1.1.1.1.2.22
--- api/core_functions.inc.php:1.1.1.1.2.21 Fri Apr 16 20:59:49 2004
+++ api/core_functions.inc.php Mon May 3 07:20:43 2004
@@ -229,7 +229,7 @@
if (__autoload($class) &&
isset($_SESSION['phpgw_session']['serialized_classes'][$var_name]))
{
$obj =
$_SESSION['phpgw_session']['serialized_classes'][$var_name];
- if(is_object($obj))
+ if (is_object($obj))
{
return $obj;
}
@@ -244,9 +244,13 @@
$args->set('inputs',NOTSET);
$args->set('silent',false);
extract($args->get(func_get_args()));
-
- if (!validate($function,'alphanumeric'))
+
+ $function_name = 'execMethod(' . $function . ')';
+ $GLOBALS['performance_timer']->start($function_name);
+
+ if (! validate($function,'alphanumeric'))
{
+ $GLOBALS['performance_timer']->stop($function_name);
return;
}
@@ -254,11 +258,13 @@
if (substr($methodname,0,2) == '__')
{
trigger_error('Attempted access for a private method: '
. $function,E_USER_ERROR);
+ $GLOBALS['performance_timer']->stop($function_name);
return '##PRIVATE_METHOD##';
}
- if(!validate($appname,'alphanumeric') &&
validate($classname,'alphanumeric') && validate($methodname,'alphanumeric'))
+ if (! validate($appname,'alphanumeric') &&
validate($classname,'alphanumeric') && validate($methodname,'alphanumeric'))
{
+ $GLOBALS['performance_timer']->stop($function_name);
return;
}
@@ -267,15 +273,21 @@
{
include_once($filename);
}
+
$class = $appname.'_'.$classname;
- $obj = createObject($class, NOTSET, $silent);
+ $obj = createObject($class, NOTSET, $silent);
if (method_exists($obj,$methodname))
{
- if($inputs == NOTSET)
+ if ($inputs == NOTSET)
{
- return $obj->$methodname();
+
$GLOBALS['performance_timer']->stop($function_name);
+ $result = $obj->$methodname();
+ return $result;
}
- return $obj->$methodname($inputs);
+
+ $GLOBALS['performance_timer']->stop($function_name);
+ $result = $obj->$methodname($inputs);
+ return $result;
}
if(!$silent)
@@ -287,7 +299,9 @@
}
trigger_error($appname . '.' . $classname . '.' .
$methodname . ' ' . $msg,E_USER_WARNING);
}
+
// If method didnt exist
+ $GLOBALS['performance_timer']->stop($function);
return '##NOMETHOD##';
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] api/core_functions.inc.php, 1.1.1.1.2.22,
nomail <=