API optimizations
* [IMRPOVEMENT] Do not include smarty globals, they are not needed on the API * [IMPROVEMENT] Display correct runtimeinformation of entire script, not just the SQL queries
This commit is contained in:
parent
0c3713284f
commit
7a73fbf099
@ -35,7 +35,6 @@ if ( ! $user->isAdmin($user_id) && ($_REQUEST['id'] != $user_id && !empty($_REQU
|
||||
$bitcoin->can_connect() === true ? $dNetworkHashrate = $bitcoin->query('getnetworkhashps') : $dNetworkHashrate = 0;
|
||||
|
||||
// Some settings
|
||||
$start = microtime(true);
|
||||
if ( ! $interval = $setting->getValue('statistics_ajax_data_interval')) $interval = 300;
|
||||
if ( ! $dPoolHashrateModifier = $setting->getValue('statistics_pool_hashrate_modifier') ) $dPoolHashrateModifier = 1;
|
||||
if ( ! $dPersonalHashrateModifier = $setting->getValue('statistics_personal_hashrate_modifier') ) $dPersonalHashrateModifier = 1;
|
||||
@ -49,8 +48,6 @@ $dPersonalHashrate = $statistics->getUserHashrate($id, $interval);
|
||||
$dPersonalSharerate = $statistics->getUserSharerate($id, $interval);
|
||||
$statistics->setGetCache(true);
|
||||
|
||||
$runtime = (microtime(true) - $start) * 1000;
|
||||
|
||||
// Apply pool modifiers
|
||||
$dPersonalHashrate = $dPersonalHashrate * $dPersonalHashrateModifier;
|
||||
$dPoolHashrate = $dPoolHashrate * $dPoolHashrateModifier;
|
||||
@ -58,7 +55,7 @@ $dNetworkHashrate = $dNetworkHashrate / 1000 * $dNetworkHashrateModifier;
|
||||
|
||||
// Output JSON format
|
||||
echo json_encode(array($_REQUEST['action'] => array(
|
||||
'datatime' => $runtime,
|
||||
'runtime' => (microtime(true) - $dTimeStart) * 1000,
|
||||
'personal' => array ( 'hashrate' => $dPersonalHashrate, 'sharerate' => $dPersonalSharerate ),
|
||||
'pool' => array( 'hashrate' => $dPoolHashrate ),
|
||||
'network' => array( 'hashrate' => $dNetworkHashrate ),
|
||||
|
||||
@ -18,6 +18,9 @@ limitations under the License.
|
||||
|
||||
*/
|
||||
|
||||
// Used for performance calculations
|
||||
$dTimeStart = microtime(true);
|
||||
|
||||
// This should be okay
|
||||
define("BASEPATH", "./");
|
||||
|
||||
@ -81,10 +84,10 @@ require_once(INCLUDE_DIR . '/smarty_globals.inc.php');
|
||||
// Load debug information into template
|
||||
$debug->append("Loading debug information into template", 4);
|
||||
$smarty->assign('DebuggerInfo', $debug->getDebugInfo());
|
||||
$smarty->assign('RUNTIME', (microtime(true) - $dTimeStart) * 1000);
|
||||
|
||||
// Display our page
|
||||
if (!@$supress_master)
|
||||
$smarty->display("master.tpl", $smarty_cache_key);
|
||||
if (!@$supress_master) $smarty->display("master.tpl", $smarty_cache_key);
|
||||
|
||||
// Unset any temporary values here
|
||||
unset($_SESSION['POPUP']);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user