当前位置: 首页>>代码示例>>PHP>>正文


PHP microtime_diff函数代码示例

本文整理汇总了PHP中microtime_diff函数的典型用法代码示例。如果您正苦于以下问题:PHP microtime_diff函数的具体用法?PHP microtime_diff怎么用?PHP microtime_diff使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了microtime_diff函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: footer

 function footer()
 {
     global $jinzora_url, $this_pgm, $version, $root_dir, $show_page_load_time, $skin, $show_jinzora_footer, $jzSERVICES, $cms_mode;
     // First let's make sure they didn't turn the footer off
     if ($show_jinzora_footer) {
         $display = new jzDisplay();
         $smarty = smartySetup();
         $smarty->assign('jinzora_url', $jinzora_url);
         $smarty->assign('link_title', $this_pgm . " " . $version);
         $poweredby = $root_dir . '/style/' . $skin . '/powered-by-small.gif';
         if (!file_exists($poweredby)) {
             $poweredby = $root_dir . '/style/images/powered-by-small.gif';
         }
         $smarty->assign('logo', $poweredby);
         $smarty->assign('page_load_time', "");
         if ($show_page_load_time == "true" and $_SESSION['jz_load_time'] != "") {
             // Ok, let's get the difference
             $diff = round(microtime_diff($_SESSION['jz_load_time'], microtime()), 3);
             if ($cms_mode == "false") {
                 $page_load = '<span class="jz_artistDesc">';
             }
             $page_load .= word("Page generated in") . ": " . $diff . " " . word("seconds");
             if ($cms_mode == "false") {
                 $page_load .= "</span>";
             }
             $smarty->assign('page_load_time', $page_load);
         }
         // Now let's display
         $smarty->display(SMARTY_ROOT . 'templates/slick/block-footer.tpl');
     }
     $jzSERVICES->cmsClose();
 }
开发者ID:seanfbrown,项目名称:jinzora,代码行数:32,代码来源:header.php

示例2: _draw_rec

    private function _draw_rec($parent, $top, $height, $level = 0)
    {
        if (!isset($this->sections[$parent['name']])) {
            $this->sections[$parent['name']] = array_pop($this->html_colors);
        }
        $color = $this->sections[$parent['name']];
        $left = 10 * $level;
        echo '<div style="border: solid white 1px; background: ' . $color . '; position: absolute; top:' . $top . 'px; left:' . $left . 'px; height:' . $height . 'px; width: 16px;"
onmouseover="info(\'' . $color . '\',\'' . $parent['name'] . '\',\'' . intval(100000 * $parent['time']) / 100 . '\',\'' . $parent['queries'] . '\', \'\')"
onmouseout="noInfo()"></div>';
        foreach ($parent['children'] as $child) {
            $child_top = $top + $height * microtime_diff($parent['microtime_start'], $child['microtime_start']) / $parent['time'];
            $child_height = $height * $child['time'] / $parent['time'];
            $this->_draw_rec($child, $child_top, $child_height, $level + 1);
        }
    }
开发者ID:fulldump,项目名称:8,代码行数:16,代码来源:load_profile.php

示例3: cron_run


//.........这里部分代码省略.........
    if (!empty($CFG->enableblogs) && $CFG->useblogassociations) {
        require_once $CFG->dirroot . '/blog/lib.php';
        // delete entries whose contextids no longer exists
        mtrace("Deleting blog associations linked to non-existent contexts...", '');
        cron_trace_time_and_memory();
        $DB->delete_records_select('blog_association', 'contextid NOT IN (SELECT id FROM {context})');
        mtrace('done.');
    }
    // Run question bank clean-up.
    mtrace("Starting the question bank cron...", '');
    cron_trace_time_and_memory();
    require_once $CFG->libdir . '/questionlib.php';
    question_bank::cron();
    mtrace('done.');
    //Run registration updated cron
    mtrace(get_string('siteupdatesstart', 'hub'));
    cron_trace_time_and_memory();
    require_once $CFG->dirroot . '/' . $CFG->admin . '/registration/lib.php';
    $registrationmanager = new registration_manager();
    $registrationmanager->cron();
    mtrace(get_string('siteupdatesend', 'hub'));
    // If enabled, fetch information about available updates and eventually notify site admins
    if (empty($CFG->disableupdatenotifications)) {
        $updateschecker = \core\update\checker::instance();
        $updateschecker->cron();
    }
    //cleanup old session linked tokens
    //deletes the session linked tokens that are over a day old.
    mtrace("Deleting session linked tokens more than one day old...", '');
    cron_trace_time_and_memory();
    $DB->delete_records_select('external_tokens', 'lastaccess < :onedayago AND tokentype = :tokentype', array('onedayago' => time() - DAYSECS, 'tokentype' => EXTERNAL_TOKEN_EMBEDDED));
    mtrace('done.');
    // all other plugins
    cron_execute_plugin_type('message', 'message plugins');
    cron_execute_plugin_type('filter', 'filters');
    cron_execute_plugin_type('editor', 'editors');
    cron_execute_plugin_type('format', 'course formats');
    cron_execute_plugin_type('profilefield', 'profile fields');
    cron_execute_plugin_type('webservice', 'webservices');
    cron_execute_plugin_type('repository', 'repository plugins');
    cron_execute_plugin_type('qbehaviour', 'question behaviours');
    cron_execute_plugin_type('qformat', 'question import/export formats');
    cron_execute_plugin_type('qtype', 'question types');
    cron_execute_plugin_type('plagiarism', 'plagiarism plugins');
    cron_execute_plugin_type('theme', 'themes');
    cron_execute_plugin_type('tool', 'admin tools');
    // and finally run any local cronjobs, if any
    if ($locals = core_component::get_plugin_list('local')) {
        mtrace('Processing customized cron scripts ...', '');
        // new cron functions in lib.php first
        cron_execute_plugin_type('local');
        // legacy cron files are executed directly
        foreach ($locals as $local => $localdir) {
            if (file_exists("{$localdir}/cron.php")) {
                include "{$localdir}/cron.php";
            }
        }
        mtrace('done.');
    }
    mtrace('Running cache cron routines');
    cache_helper::cron();
    mtrace('done.');
    // Run automated backups if required - these may take a long time to execute
    require_once $CFG->dirroot . '/backup/util/includes/backup_includes.php';
    require_once $CFG->dirroot . '/backup/util/helper/backup_cron_helper.class.php';
    backup_cron_automated_helper::run_automated_backup();
    // Run stats as at the end because they are known to take very long time on large sites
    if (!empty($CFG->enablestats) and empty($CFG->disablestatsprocessing)) {
        require_once $CFG->dirroot . '/lib/statslib.php';
        // check we're not before our runtime
        $timetocheck = stats_get_base_daily() + $CFG->statsruntimestarthour * 60 * 60 + $CFG->statsruntimestartminute * 60;
        if (time() > $timetocheck) {
            // process configured number of days as max (defaulting to 31)
            $maxdays = empty($CFG->statsruntimedays) ? 31 : abs($CFG->statsruntimedays);
            if (stats_cron_daily($maxdays)) {
                if (stats_cron_weekly()) {
                    if (stats_cron_monthly()) {
                        stats_clean_old();
                    }
                }
            }
            @set_time_limit(0);
        } else {
            mtrace('Next stats run after:' . userdate($timetocheck));
        }
    }
    // Run badges review cron.
    mtrace("Starting badges cron...");
    require_once $CFG->dirroot . '/badges/cron.php';
    badge_cron();
    mtrace('done.');
    // cleanup file trash - not very important
    $fs = get_file_storage();
    $fs->cron();
    mtrace("Cron script completed correctly");
    gc_collect_cycles();
    mtrace('Cron completed at ' . date('H:i:s') . '. Memory used ' . display_size(memory_get_usage()) . '.');
    $difftime = microtime_diff($starttime, microtime());
    mtrace("Execution took " . $difftime . " seconds");
}
开发者ID:tyleung,项目名称:CMPUT401MoodleExams,代码行数:101,代码来源:cronlib.php

示例4: get_performance_info

/**
 * get_performance_info() pairs up with init_performance_info()
 * loaded in setup.php. Returns an array with 'html' and 'txt'
 * values ready for use, and each of the individual stats provided
 * separately as well.
 *
 * @return array
 */
function get_performance_info()
{
    global $CFG, $PERF, $DB, $PAGE;
    $info = array();
    $info['txt'] = me() . ' ';
    // Holds log-friendly representation.
    $info['html'] = '';
    if (!empty($CFG->themedesignermode)) {
        // Attempt to avoid devs debugging peformance issues, when its caused by css building and so on.
        $info['html'] .= '<p><strong>Warning: Theme designer mode is enabled.</strong></p>';
    }
    $info['html'] .= '<ul class="list-unstyled m-l-1">';
    // Holds userfriendly HTML representation.
    $info['realtime'] = microtime_diff($PERF->starttime, microtime());
    $info['html'] .= '<li class="timeused">' . $info['realtime'] . ' secs</li> ';
    $info['txt'] .= 'time: ' . $info['realtime'] . 's ';
    if (function_exists('memory_get_usage')) {
        $info['memory_total'] = memory_get_usage();
        $info['memory_growth'] = memory_get_usage() - $PERF->startmemory;
        $info['html'] .= '<li class="memoryused">RAM: ' . display_size($info['memory_total']) . '</li> ';
        $info['txt'] .= 'memory_total: ' . $info['memory_total'] . 'B (' . display_size($info['memory_total']) . ') memory_growth: ' . $info['memory_growth'] . 'B (' . display_size($info['memory_growth']) . ') ';
    }
    if (function_exists('memory_get_peak_usage')) {
        $info['memory_peak'] = memory_get_peak_usage();
        $info['html'] .= '<li class="memoryused">RAM peak: ' . display_size($info['memory_peak']) . '</li> ';
        $info['txt'] .= 'memory_peak: ' . $info['memory_peak'] . 'B (' . display_size($info['memory_peak']) . ') ';
    }
    $inc = get_included_files();
    $info['includecount'] = count($inc);
    $info['html'] .= '<li class="included">Included ' . $info['includecount'] . ' files</li> ';
    $info['txt'] .= 'includecount: ' . $info['includecount'] . ' ';
    if (!empty($CFG->early_install_lang) or empty($PAGE)) {
        // We can not track more performance before installation or before PAGE init, sorry.
        return $info;
    }
    $filtermanager = filter_manager::instance();
    if (method_exists($filtermanager, 'get_performance_summary')) {
        list($filterinfo, $nicenames) = $filtermanager->get_performance_summary();
        $info = array_merge($filterinfo, $info);
        foreach ($filterinfo as $key => $value) {
            $info['html'] .= "<li class='{$key}'>{$nicenames[$key]}: {$value} </li> ";
            $info['txt'] .= "{$key}: {$value} ";
        }
    }
    $stringmanager = get_string_manager();
    if (method_exists($stringmanager, 'get_performance_summary')) {
        list($filterinfo, $nicenames) = $stringmanager->get_performance_summary();
        $info = array_merge($filterinfo, $info);
        foreach ($filterinfo as $key => $value) {
            $info['html'] .= "<li class='{$key}'>{$nicenames[$key]}: {$value} </li> ";
            $info['txt'] .= "{$key}: {$value} ";
        }
    }
    if (!empty($PERF->logwrites)) {
        $info['logwrites'] = $PERF->logwrites;
        $info['html'] .= '<li class="logwrites">Log DB writes ' . $info['logwrites'] . '</li> ';
        $info['txt'] .= 'logwrites: ' . $info['logwrites'] . ' ';
    }
    $info['dbqueries'] = $DB->perf_get_reads() . '/' . ($DB->perf_get_writes() - $PERF->logwrites);
    $info['html'] .= '<li class="dbqueries">DB reads/writes: ' . $info['dbqueries'] . '</li> ';
    $info['txt'] .= 'db reads/writes: ' . $info['dbqueries'] . ' ';
    $info['dbtime'] = round($DB->perf_get_queries_time(), 5);
    $info['html'] .= '<li class="dbtime">DB queries time: ' . $info['dbtime'] . ' secs</li> ';
    $info['txt'] .= 'db queries time: ' . $info['dbtime'] . 's ';
    if (function_exists('posix_times')) {
        $ptimes = posix_times();
        if (is_array($ptimes)) {
            foreach ($ptimes as $key => $val) {
                $info[$key] = $ptimes[$key] - $PERF->startposixtimes[$key];
            }
            $info['html'] .= "<li class=\"posixtimes\">ticks: {$info['ticks']} user: {$info['utime']} sys: {$info['stime']} cuser: {$info['cutime']} csys: {$info['cstime']}</li> ";
            $info['txt'] .= "ticks: {$info['ticks']} user: {$info['utime']} sys: {$info['stime']} cuser: {$info['cutime']} csys: {$info['cstime']} ";
        }
    }
    // Grab the load average for the last minute.
    // /proc will only work under some linux configurations
    // while uptime is there under MacOSX/Darwin and other unices.
    if (is_readable('/proc/loadavg') && ($loadavg = @file('/proc/loadavg'))) {
        list($serverload) = explode(' ', $loadavg[0]);
        unset($loadavg);
    } else {
        if (function_exists('is_executable') && is_executable('/usr/bin/uptime') && ($loadavg = `/usr/bin/uptime`)) {
            if (preg_match('/load averages?: (\\d+[\\.,:]\\d+)/', $loadavg, $matches)) {
                $serverload = $matches[1];
            } else {
                trigger_error('Could not parse uptime output!');
            }
        }
    }
    if (!empty($serverload)) {
        $info['serverload'] = $serverload;
        $info['html'] .= '<li class="serverload">Load average: ' . $info['serverload'] . '</li> ';
//.........这里部分代码省略.........
开发者ID:lucaboesch,项目名称:moodle,代码行数:101,代码来源:moodlelib.php

示例5: get_performance_info

/**
 *** get_performance_info() pairs up with init_performance_info()
 *** loaded in setup.php. Returns an array with 'html' and 'txt'
 *** values ready for use, and each of the individual stats provided
 *** separately as well.
 ***
 **/
function get_performance_info()
{
    global $CFG, $PERF, $rcache;
    $info = array();
    $info['html'] = '';
    // holds userfriendly HTML representation
    $info['txt'] = me() . ' ';
    // holds log-friendly representation
    $info['realtime'] = microtime_diff($PERF->starttime, microtime());
    $info['html'] .= '<span class="timeused">' . $info['realtime'] . ' secs</span> ';
    $info['txt'] .= 'time: ' . $info['realtime'] . 's ';
    if (function_exists('memory_get_usage')) {
        $info['memory_total'] = memory_get_usage();
        $info['memory_growth'] = memory_get_usage() - $PERF->startmemory;
        $info['html'] .= '<span class="memoryused">RAM: ' . display_size($info['memory_total']) . '</span> ';
        $info['txt'] .= 'memory_total: ' . $info['memory_total'] . 'B (' . display_size($info['memory_total']) . ') memory_growth: ' . $info['memory_growth'] . 'B (' . display_size($info['memory_growth']) . ') ';
    }
    if (function_exists('memory_get_peak_usage')) {
        $info['memory_peak'] = memory_get_peak_usage();
        $info['html'] .= '<span class="memoryused">RAM peak: ' . display_size($info['memory_peak']) . '</span> ';
        $info['txt'] .= 'memory_peak: ' . $info['memory_peak'] . 'B (' . display_size($info['memory_peak']) . ') ';
    }
    $inc = get_included_files();
    //error_log(print_r($inc,1));
    $info['includecount'] = count($inc);
    $info['html'] .= '<span class="included">Included ' . $info['includecount'] . ' files</span> ';
    $info['txt'] .= 'includecount: ' . $info['includecount'] . ' ';
    if (!empty($PERF->dbqueries)) {
        $info['dbqueries'] = $PERF->dbqueries;
        $info['html'] .= '<span class="dbqueries">DB queries ' . $info['dbqueries'] . '</span> ';
        $info['txt'] .= 'dbqueries: ' . $info['dbqueries'] . ' ';
    }
    if (!empty($PERF->logwrites)) {
        $info['logwrites'] = $PERF->logwrites;
        $info['html'] .= '<span class="logwrites">Log writes ' . $info['logwrites'] . '</span> ';
        $info['txt'] .= 'logwrites: ' . $info['logwrites'] . ' ';
    }
    if (!empty($PERF->profiling) && $PERF->profiling) {
        require_once $CFG->dirroot . '/lib/profilerlib.php';
        $info['html'] .= '<span class="profilinginfo">' . Profiler::get_profiling(array('-R')) . '</span>';
    }
    if (function_exists('posix_times')) {
        $ptimes = posix_times();
        if (is_array($ptimes)) {
            foreach ($ptimes as $key => $val) {
                $info[$key] = $ptimes[$key] - $PERF->startposixtimes[$key];
            }
            $info['html'] .= "<span class=\"posixtimes\">ticks: {$info['ticks']} user: {$info['utime']} sys: {$info['stime']} cuser: {$info['cutime']} csys: {$info['cstime']}</span> ";
            $info['txt'] .= "ticks: {$info['ticks']} user: {$info['utime']} sys: {$info['stime']} cuser: {$info['cutime']} csys: {$info['cstime']} ";
        }
    }
    // Grab the load average for the last minute
    // /proc will only work under some linux configurations
    // while uptime is there under MacOSX/Darwin and other unices
    if (is_readable('/proc/loadavg') && ($loadavg = @file('/proc/loadavg'))) {
        list($server_load) = explode(' ', $loadavg[0]);
        unset($loadavg);
    } else {
        if (function_exists('is_executable') && is_executable('/usr/bin/uptime') && ($loadavg = `/usr/bin/uptime`)) {
            if (preg_match('/load averages?: (\\d+[\\.,:]\\d+)/', $loadavg, $matches)) {
                $server_load = $matches[1];
            } else {
                trigger_error('Could not parse uptime output!');
            }
        }
    }
    if (!empty($server_load)) {
        $info['serverload'] = $server_load;
        $info['html'] .= '<span class="serverload">Load average: ' . $info['serverload'] . '</span> ';
        $info['txt'] .= "serverload: {$info['serverload']} ";
    }
    if (isset($rcache->hits) && isset($rcache->misses)) {
        $info['rcachehits'] = $rcache->hits;
        $info['rcachemisses'] = $rcache->misses;
        $info['html'] .= '<span class="rcache">Record cache hit/miss ratio : ' . "{$rcache->hits}/{$rcache->misses}</span> ";
        $info['txt'] .= 'rcache: ' . "{$rcache->hits}/{$rcache->misses} ";
    }
    $info['html'] = '<div class="performanceinfo">' . $info['html'] . '</div>';
    return $info;
}
开发者ID:nadavkav,项目名称:rtlMoodle,代码行数:87,代码来源:moodlelib.php

示例6: get_performance_info

/**
 * get_performance_info() pairs up with init_performance_info()
 * loaded in setup.php. Returns an array with 'html' and 'txt'
 * values ready for use, and each of the individual stats provided
 * separately as well.
 *
 * @global object
 * @global object
 * @global object
 * @return array
 */
function get_performance_info()
{
    global $CFG, $PERF, $DB, $PAGE;
    $info = array();
    $info['html'] = '';
    // holds userfriendly HTML representation
    $info['txt'] = me() . ' ';
    // holds log-friendly representation
    $info['realtime'] = microtime_diff($PERF->starttime, microtime());
    $info['html'] .= '<span class="timeused">' . $info['realtime'] . ' secs</span> ';
    $info['txt'] .= 'time: ' . $info['realtime'] . 's ';
    if (function_exists('memory_get_usage')) {
        $info['memory_total'] = memory_get_usage();
        $info['memory_growth'] = memory_get_usage() - $PERF->startmemory;
        $info['html'] .= '<span class="memoryused">RAM: ' . display_size($info['memory_total']) . '</span> ';
        $info['txt'] .= 'memory_total: ' . $info['memory_total'] . 'B (' . display_size($info['memory_total']) . ') memory_growth: ' . $info['memory_growth'] . 'B (' . display_size($info['memory_growth']) . ') ';
    }
    if (function_exists('memory_get_peak_usage')) {
        $info['memory_peak'] = memory_get_peak_usage();
        $info['html'] .= '<span class="memoryused">RAM peak: ' . display_size($info['memory_peak']) . '</span> ';
        $info['txt'] .= 'memory_peak: ' . $info['memory_peak'] . 'B (' . display_size($info['memory_peak']) . ') ';
    }
    $inc = get_included_files();
    //error_log(print_r($inc,1));
    $info['includecount'] = count($inc);
    $info['html'] .= '<span class="included">Included ' . $info['includecount'] . ' files</span> ';
    $info['txt'] .= 'includecount: ' . $info['includecount'] . ' ';
    $filtermanager = filter_manager::instance();
    if (method_exists($filtermanager, 'get_performance_summary')) {
        list($filterinfo, $nicenames) = $filtermanager->get_performance_summary();
        $info = array_merge($filterinfo, $info);
        foreach ($filterinfo as $key => $value) {
            $info['html'] .= "<span class='{$key}'>{$nicenames[$key]}: {$value} </span> ";
            $info['txt'] .= "{$key}: {$value} ";
        }
    }
    $stringmanager = get_string_manager();
    if (method_exists($stringmanager, 'get_performance_summary')) {
        list($filterinfo, $nicenames) = $stringmanager->get_performance_summary();
        $info = array_merge($filterinfo, $info);
        foreach ($filterinfo as $key => $value) {
            $info['html'] .= "<span class='{$key}'>{$nicenames[$key]}: {$value} </span> ";
            $info['txt'] .= "{$key}: {$value} ";
        }
    }
    $jsmodules = $PAGE->requires->get_loaded_modules();
    if ($jsmodules) {
        $yuicount = 0;
        $othercount = 0;
        $details = '';
        foreach ($jsmodules as $module => $backtraces) {
            if (strpos($module, 'yui') === 0) {
                $yuicount += 1;
            } else {
                $othercount += 1;
            }
            $details .= "<div class='yui-module'><p>{$module}</p>";
            foreach ($backtraces as $backtrace) {
                $details .= "<div class='backtrace'>{$backtrace}</div>";
            }
            $details .= '</div>';
        }
        $info['html'] .= "<span class='includedyuimodules'>Included YUI modules: {$yuicount}</span> ";
        $info['txt'] .= "includedyuimodules: {$yuicount} ";
        $info['html'] .= "<span class='includedjsmodules'>Other JavaScript modules: {$othercount}</span> ";
        $info['txt'] .= "includedjsmodules: {$othercount} ";
        // Slightly odd to output the details in a display: none div. The point
        // Is that it takes a lot of space, and if you care you can reveal it
        // using firebug.
        $info['html'] .= '<div id="yui-module-debug" class="notifytiny">' . $details . '</div>';
    }
    if (!empty($PERF->logwrites)) {
        $info['logwrites'] = $PERF->logwrites;
        $info['html'] .= '<span class="logwrites">Log DB writes ' . $info['logwrites'] . '</span> ';
        $info['txt'] .= 'logwrites: ' . $info['logwrites'] . ' ';
    }
    $info['dbqueries'] = $DB->perf_get_reads() . '/' . ($DB->perf_get_writes() - $PERF->logwrites);
    $info['html'] .= '<span class="dbqueries">DB reads/writes: ' . $info['dbqueries'] . '</span> ';
    $info['txt'] .= 'db reads/writes: ' . $info['dbqueries'] . ' ';
    if (!empty($PERF->profiling) && $PERF->profiling) {
        require_once $CFG->dirroot . '/lib/profilerlib.php';
        $info['html'] .= '<span class="profilinginfo">' . Profiler::get_profiling(array('-R')) . '</span>';
    }
    if (function_exists('posix_times')) {
        $ptimes = posix_times();
        if (is_array($ptimes)) {
            foreach ($ptimes as $key => $val) {
                $info[$key] = $ptimes[$key] - $PERF->startposixtimes[$key];
            }
//.........这里部分代码省略.........
开发者ID:hitphp,项目名称:moodle,代码行数:101,代码来源:moodlelib.php

示例7: create_clickreport_table


//.........这里部分代码省略.........
                             } else {
                                 if (isset($clicks['wrong'][$q])) {
                                     $this->data['details'][] = $wrong;
                                 } else {
                                     if (isset($click['qnumber'][$q])) {
                                         $this->data['details'][] = $nottried;
                                     } else {
                                         // this question did not appear in this attempt
                                         $this->data['details'][] = $blank;
                                     }
                                 }
                             }
                             break;
                         case 'answers':
                         case 'hints':
                         case 'clues':
                         case 'checks':
                             if (!isset($clicks[$detail][$q])) {
                                 if (!isset($click[$detail][$q])) {
                                     $this->data['details'][] = $blank;
                                 } else {
                                     $clicks[$detail][$q] = $click[$detail][$q];
                                     if ($detail == 'answers') {
                                         $this->set_legend($table, $q, $click[$detail][$q], $questions[$questionids[$q]]);
                                     }
                                     $this->data['details'][] = $click[$detail][$q];
                                     $this->update_event_count($click, $detail, $q);
                                 }
                             } else {
                                 if (!isset($click[$detail][$q])) {
                                     $this->data['details'][] = $blank;
                                 } else {
                                     $difference = '';
                                     if ($detail == 'answers') {
                                         if ($click[$detail][$q] != $clicks[$detail][$q]) {
                                             $pattern = '/^' . preg_quote($clicks[$detail][$q], '/') . ',/';
                                             $difference = preg_replace($pattern, '', $click[$detail][$q], 1);
                                         }
                                     } else {
                                         // hints, clues, checks
                                         if ($click[$detail][$q] > $clicks[$detail][$q]) {
                                             $difference = $click[$detail][$q] - $clicks[$detail][$q];
                                         }
                                     }
                                     if ($difference) {
                                         $clicks[$detail][$q] = $click[$detail][$q];
                                         $click[$detail][$q] = $difference;
                                         if ($detail == 'answers') {
                                             $this->set_legend($table, $q, $difference, $questions[$questionids[$q]]);
                                         }
                                         $this->data['details'][] = $difference;
                                         $this->update_event_count($click, $detail, $q);
                                     } else {
                                         unset($click[$detail][$q]);
                                         $this->data['details'][] = $blank;
                                     }
                                 }
                             }
                             break;
                         case 'changes':
                         case 'events':
                             if (empty($click[$detail][$q])) {
                                 $this->data['details'][] = $blank;
                             } else {
                                 $this->data['details'][] = $click[$detail][$q];
                             }
                             break;
                         default:
                             // do nothing
                             break;
                     }
                     // end switch
                 }
                 // for $q
             }
             // foreach $detail
             // set data cell values for
             $this->set_data_click($allow_review ? '<a href="review.php?hp=' . $hotpot->id . '&amp;attempt=' . $attempt->id . '">' . $clickcount . '</a>' : $clickcount, trim(userdate($attempt->timefinish, $strftimetime)), $exercisetype, $click);
             $this->set_data($cells, 'click');
             $this->set_data($cells, 'details');
             $this->set_data_totals($click, $clicks, $questioncount, $blank, $attempt);
             $this->set_data($cells, 'totals');
             $table->data[] = $cells;
             $clickcount++;
         }
         // end foreach $attempt
         // insert 'tabledivider' between users
         $table->data[] = 'hr';
     }
     // end foreach $user
     // remove final 'hr' from data rows
     array_pop($table->data);
     if ($is_html && $CFG->hotpot_showtimes) {
         $count = count($users);
         $duration = sprintf("%0.3f", microtime_diff($start_report_time, microtime()));
         print "{$count} users processed in {$duration} seconds (" . sprintf("%0.3f", $duration / $count) . ' secs/user)<hr size="1" noshade="noshade" />' . "\n";
     }
     $tables[] =& $table;
     $this->create_legend_table($tables, $table);
 }
开发者ID:edwinphillips,项目名称:moodle-485cb39,代码行数:101,代码来源:report.php

示例8: cron_run


//.........这里部分代码省略.........
    }
    core_php_time_limit::raise();
    $starttime = microtime();
    // Increase memory limit
    raise_memory_limit(MEMORY_EXTRA);
    // Emulate normal session - we use admin accoutn by default
    cron_setup_user();
    // Start output log
    $timenow = time();
    mtrace("Server Time: " . date('r', $timenow) . "\n\n");
    // Run all scheduled tasks.
    while (!\core\task\manager::static_caches_cleared_since($timenow) && ($task = \core\task\manager::get_next_scheduled_task($timenow))) {
        mtrace("Execute scheduled task: " . $task->get_name());
        cron_trace_time_and_memory();
        $predbqueries = null;
        $predbqueries = $DB->perf_get_queries();
        $pretime = microtime(1);
        try {
            get_mailer('buffer');
            $task->execute();
            if ($DB->is_transaction_started()) {
                throw new coding_exception("Task left transaction open");
            }
            if (isset($predbqueries)) {
                mtrace("... used " . ($DB->perf_get_queries() - $predbqueries) . " dbqueries");
                mtrace("... used " . (microtime(1) - $pretime) . " seconds");
            }
            mtrace("Scheduled task complete: " . $task->get_name());
            \core\task\manager::scheduled_task_complete($task);
        } catch (Exception $e) {
            if ($DB && $DB->is_transaction_started()) {
                error_log('Database transaction aborted automatically in ' . get_class($task));
                $DB->force_transaction_rollback();
            }
            if (isset($predbqueries)) {
                mtrace("... used " . ($DB->perf_get_queries() - $predbqueries) . " dbqueries");
                mtrace("... used " . (microtime(1) - $pretime) . " seconds");
            }
            mtrace("Scheduled task failed: " . $task->get_name() . "," . $e->getMessage());
            if ($CFG->debugdeveloper) {
                if (!empty($e->debuginfo)) {
                    mtrace("Debug info:");
                    mtrace($e->debuginfo);
                }
                mtrace("Backtrace:");
                mtrace(format_backtrace($e->getTrace(), true));
            }
            \core\task\manager::scheduled_task_failed($task);
        }
        get_mailer('close');
        unset($task);
    }
    // Run all adhoc tasks.
    while (!\core\task\manager::static_caches_cleared_since($timenow) && ($task = \core\task\manager::get_next_adhoc_task($timenow))) {
        mtrace("Execute adhoc task: " . get_class($task));
        cron_trace_time_and_memory();
        $predbqueries = null;
        $predbqueries = $DB->perf_get_queries();
        $pretime = microtime(1);
        try {
            get_mailer('buffer');
            $task->execute();
            if ($DB->is_transaction_started()) {
                throw new coding_exception("Task left transaction open");
            }
            if (isset($predbqueries)) {
                mtrace("... used " . ($DB->perf_get_queries() - $predbqueries) . " dbqueries");
                mtrace("... used " . (microtime(1) - $pretime) . " seconds");
            }
            mtrace("Adhoc task complete: " . get_class($task));
            \core\task\manager::adhoc_task_complete($task);
        } catch (Exception $e) {
            if ($DB && $DB->is_transaction_started()) {
                error_log('Database transaction aborted automatically in ' . get_class($task));
                $DB->force_transaction_rollback();
            }
            if (isset($predbqueries)) {
                mtrace("... used " . ($DB->perf_get_queries() - $predbqueries) . " dbqueries");
                mtrace("... used " . (microtime(1) - $pretime) . " seconds");
            }
            mtrace("Adhoc task failed: " . get_class($task) . "," . $e->getMessage());
            if ($CFG->debugdeveloper) {
                if (!empty($e->debuginfo)) {
                    mtrace("Debug info:");
                    mtrace($e->debuginfo);
                }
                mtrace("Backtrace:");
                mtrace(format_backtrace($e->getTrace(), true));
            }
            \core\task\manager::adhoc_task_failed($task);
        }
        get_mailer('close');
        unset($task);
    }
    mtrace("Cron script completed correctly");
    gc_collect_cycles();
    mtrace('Cron completed at ' . date('H:i:s') . '. Memory used ' . display_size(memory_get_usage()) . '.');
    $difftime = microtime_diff($starttime, microtime());
    mtrace("Execution took " . $difftime . " seconds");
}
开发者ID:educakanchay,项目名称:campus,代码行数:101,代码来源:cronlib.php

示例9: do_site


//.........这里部分代码省略.........
    unset($middle);
    $out->attach($global);
    $out->attach(do_footer());
    $out->handle_symbol_preprocessing();
    if (get_value('xhtml_strict') === '1') {
        $out = make_xhtml_strict($out);
    }
    // Validation
    $novalidate = get_param_integer('keep_novalidate', get_param_integer('novalidate', 0));
    $show_edit_links = get_param_integer('show_edit_links', 0);
    if ((in_array(ocp_srv('HTTP_HOST'), array('localhost', 'test.ocportal.com')) || $GLOBALS['FORUM_DRIVER']->is_staff(get_member())) && ($special_page_type == 'code' || $novalidate == 0 && get_option('validation') == '1') && $GLOBALS['REFRESH_URL'][0] == '' && $show_edit_links == 0) {
        require_code('view_modes');
        $out_evaluated = $out->evaluate(NULL, false);
        do_xhtml_validation($out_evaluated, $special_page_type == 'code' && get_param_integer('preview_mode', NULL) === NULL, get_param_integer('preview_mode', 0));
    }
    // Cacheing for spiders
    if (running_script('index') && count($_POST) == 0 && isset($GLOBALS['SITE_INFO']['fast_spider_cache']) && $GLOBALS['SITE_INFO']['fast_spider_cache'] == '1' && is_guest()) {
        $bot_type = get_bot_type();
        if (($bot_type !== NULL || isset($GLOBALS['SITE_INFO']['any_guest_cached_too']) && $GLOBALS['SITE_INFO']['any_guest_cached_too'] == '1') && can_fast_spider_cache()) {
            $fast_cache_path = get_custom_file_base() . '/persistant_cache/' . md5(serialize(get_self_url_easy()));
            if ($bot_type === NULL) {
                $fast_cache_path .= '__non-bot';
            }
            if (!array_key_exists('js_on', $_COOKIE)) {
                $fast_cache_path .= '__no-js';
            }
            if (is_mobile()) {
                $fast_cache_path .= '_mobile';
            }
            $fast_cache_path .= '.gcd';
            if (!is_dir(get_custom_file_base() . '/persistant_cache/')) {
                if (@mkdir(get_custom_file_base() . '/persistant_cache/', 0777)) {
                    fix_permissions(get_custom_file_base() . '/persistant_cache/', 0777);
                    sync_file(get_custom_file_base() . '/persistant_cache/');
                } else {
                    intelligent_write_error($fast_cache_path);
                }
            }
            $out_evaluated = $out->evaluate(NULL, false);
            $myfile = @fopen($fast_cache_path, 'wb') or intelligent_write_error($fast_cache_path);
            if (function_exists('gzencode')) {
                fwrite($myfile, gzencode($out_evaluated, 9));
            } else {
                fwrite($myfile, $out_evaluated);
            }
            fclose($myfile);
            fix_permissions($fast_cache_path);
            sync_file($fast_cache_path);
        }
    }
    if ($doing_special_page_type) {
        special_page_types($special_page_type, $out, $out_evaluated);
    }
    // We calculated the time before outputting so that latency and bandwidth do not adversely affect the result
    global $PAGE_START_TIME, $PAGE_STRING;
    $page_generation_time = microtime_diff($PAGE_START_TIME, microtime(false));
    if (!$GLOBALS['QUICK_REDIRECT']) {
        if ($out_evaluated !== NULL) {
            echo $out_evaluated;
        } else {
            $GLOBALS['FINISHING_OUTPUT'] = true;
            $out->evaluate_echo();
        }
    }
    // Finally, stats
    if ($PAGE_STRING !== NULL) {
        log_stats($PAGE_STRING, intval($page_generation_time));
    }
    // When someone hits the Admin Zone front page.
    if ($ZONE['zone_name'] == 'adminzone' && get_page_name() == 'start') {
        // Security feature admins can turn on
        require_code('notifications');
        $current_username = $GLOBALS['FORUM_DRIVER']->get_username(get_member());
        $subject = do_lang('AFA_NOTIFICATION_MAIL_SUBJECT', $current_username, get_site_name(), get_ip_address());
        $mail = do_lang('AFA_NOTIFICATION_MAIL', comcode_escape(get_site_name()), comcode_escape($current_username), comcode_escape(get_ip_address()));
        dispatch_notification('adminzone_frontpage_accessed', NULL, $subject, $mail);
        // Track very basic details of what sites use ocPortal. You can remove if you like.
        if (preg_match('#^localhost[\\.\\:$]?#', ocp_srv('HTTP_HOST')) == 0) {
            global $EXPIRE, $KEY;
            $timeout_before = @ini_get('default_socket_timeout');
            @ini_set('default_socket_timeout', '3');
            http_download_file('http://ocportal.com/user.php?url=' . urlencode(get_base_url()) . '&name=' . urlencode(get_site_name()) . '&registered=2&key=' . ($KEY === NULL ? '' : strval($KEY)) . '&expire=' . ($EXPIRE === NULL ? '' : strval($EXPIRE)) . '&version=' . urlencode(ocp_version_full()), NULL, false);
            @ini_set('default_socket_timeout', $timeout_before);
        }
    }
    // Little disk space check
    $last_space_check = get_value('last_space_check');
    if ($last_space_check === NULL || intval($last_space_check) < time() - 60 * 60 * 3) {
        set_value('last_space_check', strval(time()));
        $low_space_check = intval(get_option('low_space_check')) * 1024 * 1024;
        $disk_space = @disk_free_space(get_file_base());
        if (is_integer($disk_space) && $disk_space < $low_space_check) {
            require_code('notifications');
            $subject = do_lang('LOW_DISK_SPACE_SUBJECT', NULL, NULL, NULL, get_site_default_lang());
            $message = do_lang('LOW_DISK_SPACE_MAIL', strval(intval(round($disk_space / 1024 / 1024))), NULL, NULL, get_site_default_lang());
            dispatch_notification('low_disk_space', NULL, $subject, $message, NULL, A_FROM_SYSTEM_PRIVILEGED);
        }
    }
    //exit();
}
开发者ID:erico-deh,项目名称:ocPortal,代码行数:101,代码来源:site.php

示例10: cron

 /**
  * cron - goes through all the feeds. If the feed has a skipuntil value
  * that is less than the current time cron will attempt to retrieve it
  * with the cache duration set to 0 in order to force the retrieval of
  * the item and refresh the cache.
  *
  * If a feed fails then the skipuntil time of that feed is set to be
  * later than the next expected cron time. The amount of time will
  * increase each time the fetch fails until the maximum is reached.
  *
  * If a feed that has been failing is successfully retrieved it will
  * go back to being handled as though it had never failed.
  *
  * CRON should therefor process requests for permanently broken RSS
  * feeds infrequently, and temporarily unavailable feeds will be tried
  * less often until they become available again.
  *
  * @return boolean Always returns true
  */
 function cron()
 {
     global $CFG, $DB;
     require_once $CFG->libdir . '/simplepie/moodle_simplepie.php';
     // Get the legacy cron time, strangely the cron property of block_base
     // does not seem to get set. This means we must retrive it here.
     $this->cron = $DB->get_field('block', 'cron', array('name' => 'rss_client'));
     // We are going to measure execution times
     $starttime = microtime();
     $starttimesec = time();
     // Fetch all site feeds.
     $rs = $DB->get_recordset('block_rss_client');
     $counter = 0;
     mtrace('');
     foreach ($rs as $rec) {
         mtrace('    ' . $rec->url . ' ', '');
         // Skip feed if it failed recently.
         if ($starttimesec < $rec->skipuntil) {
             mtrace('skipping until ' . userdate($rec->skipuntil));
             continue;
         }
         // Fetch the rss feed, using standard simplepie caching
         // so feeds will be renewed only if cache has expired
         core_php_time_limit::raise(60);
         $feed = new moodle_simplepie();
         // set timeout for longer than normal to be agressive at
         // fetching feeds if possible..
         $feed->set_timeout(40);
         $feed->set_cache_duration(0);
         $feed->set_feed_url($rec->url);
         $feed->init();
         if ($feed->error()) {
             // Skip this feed (for an ever-increasing time if it keeps failing).
             $rec->skiptime = $this->calculate_skiptime($rec->skiptime);
             $rec->skipuntil = time() + $rec->skiptime;
             $DB->update_record('block_rss_client', $rec);
             mtrace("Error: could not load/find the RSS feed - skipping for {$rec->skiptime} seconds.");
         } else {
             mtrace('ok');
             // It worked this time, so reset the skiptime.
             if ($rec->skiptime > 0) {
                 $rec->skiptime = 0;
                 $rec->skipuntil = 0;
                 $DB->update_record('block_rss_client', $rec);
             }
             // Only increase the counter when a feed is sucesfully refreshed.
             $counter++;
         }
     }
     $rs->close();
     // Show times
     mtrace($counter . ' feeds refreshed (took ' . microtime_diff($starttime, microtime()) . ' seconds)');
     return true;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:73,代码来源:block_rss_client.php

示例11: die

<?php

if (!defined(JZ_SECURE_ACCESS)) {
    die('Security breach detected.');
}
$smarty->assign('jinzora_url', $jinzora_url);
$smarty->assign('version', $version);
$smarty->assign('image_dir', $image_dir);
$smarty->assign('page_load', "");
if ($show_page_load_time == "true" and $_SESSION['jz_load_time'] != "") {
    // Ok, let's get the difference
    $diff = round(microtime_diff($_SESSION['jz_load_time'], microtime()), 3);
    $smarty->assign('page_load', $diff . " " . word("seconds") . "&nbsp;");
}
if ($jzUSER->getID() == $jzUSER->lookupUID('NOBODY')) {
    $smarty->assign("logged_in", false);
} else {
    $smarty->assign("logged_in", true);
}
$smarty->assign('username', $jzUSER->getName());
$smarty->assign('word_logged_in', word("Logged in as"));
jzTemplate($smarty, "footer");
$jzSERVICES->cmsClose();
开发者ID:seanfbrown,项目名称:jinzora,代码行数:23,代码来源:footer.php

示例12: get_performance_info

/**
 * get_performance_info() pairs up with init_performance_info()
 * loaded in setup.php. Returns an array with 'html' and 'txt'
 * values ready for use, and each of the individual stats provided
 * separately as well.
 *
 * @global object
 * @global object
 * @global object
 * @return array
 */
function get_performance_info() {
    global $CFG, $PERF, $DB, $PAGE;

    $info = array();
    $info['html'] = '';         // holds userfriendly HTML representation
    $info['txt']  = me() . ' '; // holds log-friendly representation

    $info['realtime'] = microtime_diff($PERF->starttime, microtime());

    $info['html'] .= '<span class="timeused">'.$info['realtime'].' secs</span> ';
    $info['txt'] .= 'time: '.$info['realtime'].'s ';

    if (function_exists('memory_get_usage')) {
        $info['memory_total'] = memory_get_usage();
        $info['memory_growth'] = memory_get_usage() - $PERF->startmemory;
        $info['html'] .= '<span class="memoryused">RAM: '.display_size($info['memory_total']).'</span> ';
        $info['txt']  .= 'memory_total: '.$info['memory_total'].'B (' . display_size($info['memory_total']).') memory_growth: '.$info['memory_growth'].'B ('.display_size($info['memory_growth']).') ';
    }

    if (function_exists('memory_get_peak_usage')) {
        $info['memory_peak'] = memory_get_peak_usage();
        $info['html'] .= '<span class="memoryused">RAM peak: '.display_size($info['memory_peak']).'</span> ';
        $info['txt']  .= 'memory_peak: '.$info['memory_peak'].'B (' . display_size($info['memory_peak']).') ';
    }

    $inc = get_included_files();
    //error_log(print_r($inc,1));
    $info['includecount'] = count($inc);
    $info['html'] .= '<span class="included">Included '.$info['includecount'].' files</span> ';
    $info['txt']  .= 'includecount: '.$info['includecount'].' ';

    $filtermanager = filter_manager::instance();
    if (method_exists($filtermanager, 'get_performance_summary')) {
        list($filterinfo, $nicenames) = $filtermanager->get_performance_summary();
        $info = array_merge($filterinfo, $info);
        foreach ($filterinfo as $key => $value) {
            $info['html'] .= "<span class='$key'>$nicenames[$key]: $value </span> ";
            $info['txt'] .= "$key: $value ";
        }
    }

    $stringmanager = get_string_manager();
    if (method_exists($stringmanager, 'get_performance_summary')) {
        list($filterinfo, $nicenames) = $stringmanager->get_performance_summary();
        $info = array_merge($filterinfo, $info);
        foreach ($filterinfo as $key => $value) {
            $info['html'] .= "<span class='$key'>$nicenames[$key]: $value </span> ";
            $info['txt'] .= "$key: $value ";
        }
    }

     $jsmodules = $PAGE->requires->get_loaded_modules();
     if ($jsmodules) {
         $yuicount = 0;
         $othercount = 0;
         $details = '';
         foreach ($jsmodules as $module => $backtraces) {
             if (strpos($module, 'yui') === 0) {
                 $yuicount += 1;
             } else {
                 $othercount += 1;
             }
             if (!empty($CFG->yuimoduledebug)) {
                 // hidden feature for developers working on YUI module infrastructure
                 $details .= "<div class='yui-module'><p>$module</p>";
                 foreach ($backtraces as $backtrace) {
                     $details .= "<div class='backtrace'>$backtrace</div>";
                 }
                 $details .= '</div>';
             }
         }
         $info['html'] .= "<span class='includedyuimodules'>Included YUI modules: $yuicount</span> ";
         $info['txt'] .= "includedyuimodules: $yuicount ";
         $info['html'] .= "<span class='includedjsmodules'>Other JavaScript modules: $othercount</span> ";
         $info['txt'] .= "includedjsmodules: $othercount ";
         if ($details) {
             $info['html'] .= '<div id="yui-module-debug" class="notifytiny">'.$details.'</div>';
         }
     }

    if (!empty($PERF->logwrites)) {
        $info['logwrites'] = $PERF->logwrites;
        $info['html'] .= '<span class="logwrites">Log DB writes '.$info['logwrites'].'</span> ';
        $info['txt'] .= 'logwrites: '.$info['logwrites'].' ';
    }

    $info['dbqueries'] = $DB->perf_get_reads().'/'.($DB->perf_get_writes() - $PERF->logwrites);
    $info['html'] .= '<span class="dbqueries">DB reads/writes: '.$info['dbqueries'].'</span> ';
    $info['txt'] .= 'db reads/writes: '.$info['dbqueries'].' ';
//.........这里部分代码省略.........
开发者ID:nutanrajmalanai,项目名称:moodle,代码行数:101,代码来源:moodlelib.php

示例13: get_statistic

function get_statistic($t = 0, $m = 0, $q = 0, $l = 0)
{
    global $AVE_DB;
    $s = '';
    if ($t) {
        $s .= "\n<br>Время генерации: " . number_format(microtime_diff(START_MICROTIME, microtime()), 3, ',', ' ') . ' сек.';
    }
    if ($m && function_exists('memory_get_peak_usage')) {
        $s .= "\n<br>Пиковое значение " . number_format(memory_get_peak_usage() / 1024, 0, ',', ' ') . 'Kb';
    }
    //	if ($q) $s .= "\n<br>Количество запросов: " . $AVE_DB->DBStatisticGet('count') . ' шт. за ' . number_format($AVE_DB->DBStatisticGet('time')*1000, 3, ',', '.') . ' мксек.';
    //	if ($l) $s .= "\n<br><div style=\"text-align:left;padding-left:30px\"><small><ol>" . $AVE_DB->DBStatisticGet('list') . '</ol></small></div>';
    if ($q && !defined('SQL_PROFILING_DISABLE')) {
        $s .= "\n<br>Количество запросов: " . $AVE_DB->DBProfilesGet('count') . ' шт. за ' . $AVE_DB->DBProfilesGet('time') . ' сек.';
    }
    if ($l && !defined('SQL_PROFILING_DISABLE')) {
        $s .= $AVE_DB->DBProfilesGet('list');
    }
    return $s;
}
开发者ID:RGBvision,项目名称:AVE.cms,代码行数:20,代码来源:func.common.php

示例14: test_get_parent_path_tree

    /**
     * Test times for get_parent using recursive get_parent alfresco calls
     * @uses $CFG, $DB
     */
    public function test_get_parent_path_tree() {
        global $CFG, $DB;

        $this->resetAfterTest(true);
        $this->setup_test_data_xml();

        $options = array(
            'ajax' => false,
            'name' => 'elis files phpunit test',
            'type' => 'elisfiles'
        );

        $repo = new repository_elisfiles('elisfiles', context_system::instance(), $options);

        // Make sure we connected to the repository successfully.
        if (empty($repo->elis_files)) {
            $this->markTestSkipped('Repository not configured or enabled');
        }

        // set up the storage for the full path of the path's UUIDs to validate against
        $expectedpath = array();

        // create folder, get uuid, get path via get_parent_path and elis_files_folder structure
        // for first folder, create under moodle, then create under the previous folder...
        $parentfolderuuid = $repo->elis_files->get_root()->uuid;
        $times = array();
        for ($i = 1; $i <= 20; $i++) {
            $currentfolder = FOLDER_NAME_PREFIX.$i;

            $currentfolderuuid = $repo->elis_files->create_dir($currentfolder, $parentfolderuuid, '', true);

            // add the parent folder to our expected sequence of UUIDs
            $expectedpath[] = repository_elisfiles::build_encodedpath($parentfolderuuid);

            // elis_files_folder_structure get_parent_path test
            $starttime = microtime();
            $folders = elis_files_folder_structure();
            $altrecursivepath = array();
            $repo->get_parent_path($currentfolderuuid, $altrecursivepath, 0, 0, 0, 0, 'tree');
            $endtime = time();
            $structuretime = microtime_diff($starttime, microtime());

            // validate the count
            $this->assertEquals($i, count($altrecursivepath));
            // validate the encoded folder UUIDs

            // look over the expected path parts
            foreach ($expectedpath as $pathindex => $expectedpart) {
                // obtain the matching part from the actual return value
                $resultpart = $altrecursivepath[$pathindex];
                $this->assertEquals($expectedpart, $resultpart['path']);
            }

            // NOTE: add this back in if we are testing performance
            $times[] = $times[] = "Folder: $currentfolder and time: $structuretime";

            // or nested folders
            $parentfolderuuid = $currentfolderuuid;
        }
    }
开发者ID:jamesmcq,项目名称:elis,代码行数:64,代码来源:folder_path_test.php

示例15: str_replace

        }
        if ($object->IsWYSIWYG() && $object->WYSIWYGActive()) {
            $bodytext .= $object->WYSIWYGGenerateBody();
            $headertext .= $object->WYSIWYGGenerateHeader($htmlresult);
            $formtext .= $object->WYSIWYGPageForm();
            $formsubmittext .= $object->WYSIWYGPageFormSubmit();
            //break;
        } else {
            if ($object->IsSyntaxHighlighter() && $object->SyntaxActive()) {
                $bodytext .= $object->SyntaxGenerateBody();
                $headertext .= $object->SyntaxGenerateHeader($htmlresult);
                $formtext .= $object->SyntaxPageForm();
                $formsubmittext .= $object->SyntaxPageFormSubmit();
                // break;
            }
        }
    }
}
$htmlresult = $themeObject->postprocess($htmlresult);
$htmlresult = str_replace('<!-- THIS IS WHERE HEADER STUFF SHOULD GO -->', $headertext, $htmlresult);
$htmlresult = str_replace('##FORMSUBMITSTUFFGOESHERE##', ' ' . $formtext, $htmlresult);
$htmlresult = str_replace('##INLINESUBMITSTUFFGOESHERE##', ' ' . $formsubmittext, $htmlresult);
$htmlresult = str_replace('##BODYSUBMITSTUFFGOESHERE##', ' ' . $bodytext, $htmlresult);
echo $htmlresult;
$db = cmsms()->GetDb();
$endtime = microtime();
$memory = function_exists('memory_get_usage') ? memory_get_usage() : 0;
$memory_net = $memory - $orig_memory;
$memory_peak = function_exists('memory_get_peak_usage') ? memory_get_peak_usage() : 0;
echo "<!-- " . microtime_diff($starttime, $endtime) . " / " . (isset($db->query_count) ? $db->query_count : '') . " / {$memory_net} / {$memory} / {$memory_peak} -->\n";
# vim:ts=4 sw=4 noet
开发者ID:RTR-ITF,项目名称:usse-cms,代码行数:31,代码来源:footer.php


注:本文中的microtime_diff函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。