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


PHP profiling_start函数代码示例

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


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

示例1: wikipedia_search

function wikipedia_search($procd_descr)
{
    profiling_start('wikipedia_search');
    $TERMS = wikipedia_process_term($procd_descr);
    $url = wikipedia_url($TERMS);
    $data = cached_file_get_contents($url);
    Error::setPrepend($data);
    Error::generate('debug', 'WIKIPEDIA');
    eval('$arr = ' . $data . ';');
    foreach ($arr['query']['pages'] as $k => $v) {
        $title = urlencode($v['title']);
        $url = urlencode($v['fullurl']);
        // https://dgl.cx/2008/10/wikipedia-summary-dns
        if ($k == -1) {
            // not found
            return array();
        }
        break;
    }
    // this is probably a topic from a random unintended field like "frequency analysis (cryptoanalysis)"
    if (strlen($title) < strlen($TERMS) - 5 || strlen($title) > strlen($TERMS) + 5 || strrchr($title, '%28')) {
        return array();
    }
    $store = array('title' => urldecode(str_replace('+', ' ', $title)), 'link' => urldecode($url), 'source' => 'wikipedia');
    profiling_end('wikipedia_search');
    return array($store);
}
开发者ID:ritthai,项目名称:LMS,代码行数:27,代码来源:wikipedia.util.php

示例2: google_search

function google_search($procd_descr)
{
    profiling_start('google_search');
    $TERMS = urlencode($procd_descr . " Lecture Notes");
    $USERIP = $_SERVER['REMOTE_ADDR'];
    $url = "http://ajax.googleapis.com/ajax/services/search/web?v=1.0&q={$TERMS}&rsz=small";
    $data = cached_file_get_contents($url);
    $arr = json_decode($data, true);
    $results = $arr['responseData']['results'];
    $store = array();
    foreach ($results as $elem) {
        $link = $elem['url'];
        $title = $elem['titleNoFormatting'];
        array_push($store, array('title' => $title, 'link' => $link, 'source' => 'google'));
    }
    profiling_end('google_search');
    return $store;
}
开发者ID:ritthai,项目名称:LMS,代码行数:18,代码来源:google.util.php

示例3: khanacad_search

function khanacad_search($procd_descr, $tags = array())
{
    global $CONFIG;
    global $ROOT;
    profiling_start('khanacad_search');
    $TERMS = urlencode($procd_descr);
    $URL = "{$ROOT}/scraping/khan.xml";
    $data = file_get_contents($URL);
    $parser = xml_parser_create();
    $status = xml_parse_into_struct($parser, $data, $xml);
    if ($status == 0) {
        echo xml_error_string(xml_get_error_code($parser));
    }
    xml_parser_free($parser);
    $terms = preg_split("/\\s+|\\+/", $TERMS, null, PREG_SPLIT_NO_EMPTY);
    $ret = search_with_tags($terms, $tags, 'khanacad_query', $xml);
    profiling_end('khanacad_search');
    return $ret;
}
开发者ID:ritthai,项目名称:LMS,代码行数:19,代码来源:khanacad.util.php

示例4: itunesu_search

function itunesu_search($procd_descr)
{
    $TERMS = urlencode($procd_descr);
    $USERIP = $_SERVER['REMOTE_ADDR'];
    $NRESULTS = 4;
    profiling_start('itunesu_search');
    ini_set('user_agent', 'iTunes/8.1');
    $url = "http://ax.search.itunes.apple.com/WebObjects/MZSearch.woa/wa/advancedSearch?descriptionTerm={$TERMS}&media=iTunesU";
    $data = cached_file_get_contents($url);
    $parser = xml_parser_create();
    xml_parse_into_struct($parser, $data, $xml);
    xml_parser_free($parser);
    $store = array();
    foreach ($xml as $key => $elem) {
        if ($elem['tag'] == 'GOTOURL' && $elem['level'] == 21 && $elem['type'] == 'open' && count($store) < $NRESULTS) {
            array_push($store, array('source' => 'itunesu', 'url' => $elem['attributes']['URL'], 'title' => $elem['attributes']['DRAGGINGNAME'], 'art' => $xml[$key + 2]['attributes']['URL']));
        }
    }
    profiling_end('itunesu_search');
    return $store;
}
开发者ID:ritthai,项目名称:LMS,代码行数:21,代码来源:itunesu.util.php

示例5: define

                define('NO_MOODLE_COOKIES', false);
            }
        }
    }
}
// start session and prepare global $SESSION, $USER
session_get_instance();
$SESSION =& $_SESSION['SESSION'];
$USER =& $_SESSION['USER'];
// initialise ME's
// This must presently come AFTER $USER has been set up.
initialise_fullme();
// Late profiling, only happening if early one wasn't started
if (!empty($CFG->profilingenabled)) {
    require_once $CFG->libdir . '/xhprof/xhprof_moodle.php';
    if (profiling_start()) {
        register_shutdown_function('profiling_stop');
    }
}
// Process theme change in the URL.
if (!empty($CFG->allowthemechangeonurl) and !empty($_GET['theme'])) {
    // we have to use _GET directly because we do not want this to interfere with _POST
    $urlthemename = optional_param('theme', '', PARAM_SAFEDIR);
    try {
        $themeconfig = theme_config::load($urlthemename);
        // Makes sure the theme can be loaded without errors.
        if ($themeconfig->name === $urlthemename) {
            $SESSION->theme = $urlthemename;
        } else {
            unset($SESSION->theme);
        }
开发者ID:hatone,项目名称:moodle,代码行数:31,代码来源:setup.php

示例6: profiling_start

            @header('Content-type: application/json; charset=utf-8');
        }
    }
} else {
    if (!CLI_SCRIPT) {
        @header('Content-type: text/html; charset=utf-8');
    }
}
// Initialise some variables that are supposed to be set in config.php only.
if (!isset($CFG->filelifetime)) {
    $CFG->filelifetime = 60 * 60 * 6;
}
// Late profiling, only happening if early one wasn't started
if (!empty($CFG->profilingenabled)) {
    require_once $CFG->libdir . '/xhprof/xhprof_moodle.php';
    profiling_start();
}
// Hack to get around max_input_vars restrictions,
// we need to do this after session init to have some basic DDoS protection.
workaround_max_input_vars();
// Process theme change in the URL.
if (!empty($CFG->allowthemechangeonurl) and !empty($_GET['theme'])) {
    // we have to use _GET directly because we do not want this to interfere with _POST
    $urlthemename = optional_param('theme', '', PARAM_PLUGIN);
    try {
        $themeconfig = theme_config::load($urlthemename);
        // Makes sure the theme can be loaded without errors.
        if ($themeconfig->name === $urlthemename) {
            $SESSION->theme = $urlthemename;
        } else {
            unset($SESSION->theme);
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:31,代码来源:setup.php

示例7: array_filter

         }), 'wikipedia' => array_filter($results, function ($elem) {
             return filter_result($elem, array('source' => 'wikipedia', 'rating' => 0));
         }), 'khanacad' => array_filter($results, function ($elem) {
             return filter_result($elem, array('source' => 'khanacad', 'rating' => 1.1));
         }), 'itunesu' => array_filter($results, function ($elem) {
             return filter_result($elem, array('source' => 'itunesu', 'rating' => 1));
         }), 'comment_id' => $topicid, 'comments' => array_map(function ($a) {
             return $a['id'];
         }, Comment::ListAll($topicid))));
         Error::generate('debug', "finishing deal with tags and procd_descr, topic {$topicid}/{$topicsubject}, result:");
         Error::generate('debug', $search_results);
     }
     $memcached->set('' . $icrs->cid, $search_results);
 }
 profiling_end('deal with tags and procd_descr');
 profiling_start('wrap up processing and package data for the view');
 $args['pagetitle'] = "{$icrs->title} ({$icrs->code})";
 $args['pageurl'] = $_SERVER['REQUEST_URI'];
 $args['course'] = array('id' => (int) $icrs->id, 'title' => $icrs->title, 'code' => $icrs->code, 'descr' => $icrs->descr);
 $args['searchresults'] = $search_results;
 $args['comment_id'] = $icrs->cid;
 $args['comments'] = array_map(function ($a) {
     return $a['id'];
 }, Comment::ListAll($icrs->cid));
 $args['actions'] = $ACTIONS;
 $_SESSION['lastargs'] = $args;
 preg_match('/^[a-zA-Z]+/', $icrs->code, $matches);
 $args['code'] = $matches[0];
 $args['university'] = array('id' => $icrs->university, 'name' => University::GetName($icrs->university));
 $args['area'] = array('id' => $areaid = University::GetAreaID($args['university']['id']), 'name' => Area::GetName($areaid));
 $args['country'] = array('id' => $countryid = Area::GetCountryID($args['area']), 'name' => Country::GetName($countryid));
开发者ID:ritthai,项目名称:LMS,代码行数:31,代码来源:index.php

示例8: youtube_query

function youtube_query($TERMS, $srch, $crs)
{
    global $CONFIG;
    profiling_start('youtube_query');
    $TAGS = $srch;
    $rtags = get_full_tags($crs);
    $str = urlencode($TERMS);
    //."+".implode("+", $srch);
    $url = "http://gdata.youtube.com/feeds/api/videos?q={$str}&orderby=relevance&start-index=1&max-results=2&v=2&format=5";
    $data = cached_file_get_contents($url);
    $parser = xml_parser_create();
    xml_parse_into_struct($parser, $data, $xml);
    xml_parser_free($parser);
    $store = array();
    foreach ($xml as $elem) {
        switch ($elem['tag']) {
            case 'MEDIA:THUMBNAIL':
                $content['thumbnail_url'] = $elem['attributes']['URL'];
                $content['thumbnail_width'] = $elem['attributes']['WIDTH'];
                $content['thumbnail_height'] = $elem['attributes']['HEIGHT'];
                break;
            case 'MEDIA:PLAYER':
                $content['link'] = $elem['attributes']['URL'];
                break;
            case 'CONTENT':
                if ($elem['attributes']['TYPE'] == 'application/x-shockwave-flash') {
                    $val = $elem['attributes']['SRC'];
                } else {
                    continue 2;
                }
                $content['src'] = $val;
                break;
            case 'MEDIA:CATEGORY':
                if ($val != 'Howto' && $val != 'Education' && $val != 'News' && $val != 'Tech') {
                    continue 2;
                } else {
                    if ($val == 'Education') {
                        $content['rating'] += 5;
                    }
                }
                $val = $elem['value'];
                $content[strtolower($elem['tag'])] = $val;
                break;
            case 'CATEGORY':
                if ($elem['attributes']['SCHEME'] != 'http://gdata.youtube.com/schemas/2007/categories.cat') {
                    continue 2;
                } else {
                    $val = $elem['attributes']['TERM'];
                    if ($val != 'Howto' && $val != 'Education' && $val != 'News' && $val != 'Tech') {
                        continue 2;
                    } else {
                        if ($val == 'Education') {
                            $content['rating'] += 5;
                        }
                    }
                    $content[strtolower($elem['tag'])] = $val;
                }
                break;
            case 'MEDIA:KEYWORDS':
                $val = $elem['value'];
                if (!$val) {
                    continue 2;
                }
                if ($rtags) {
                    $matches = count_matches(explode(', ', $val), explode(',', $rtags));
                } else {
                    $matches = false;
                }
                if ($matches > 0) {
                    $content[strtolower($elem['tag'])] = $val;
                    $content['rating'] += 5;
                } else {
                    $content['rating'] -= 5;
                    continue 2;
                }
                break;
            case 'MEDIA:DESCRIPTION':
                // YT:RATING : attributes : NUMDISLIKES, NUMLIKES
                $val = $elem['value'];
                if ($rtags) {
                    $matches = count_matches(explode(' ', $val), explode(',', $rtags));
                } else {
                    $matches = false;
                }
                if ($matches && $matches > 0) {
                    $content[strtolower($elem['tag'])] = $val;
                    $content['rating'] += 2;
                } else {
                    $content['rating'] -= 2;
                    continue 2;
                }
                break;
            case 'TITLE':
                $val = $elem['value'];
                $content[strtolower($elem['tag'])] = $val;
                break;
            case 'ENTRY':
                if ($elem['type'] == 'open') {
                    $content = array('src' => false, 'title' => false, 'media:keywords' => false, 'media:description' => false, 'category' => false, 'rating' => 10, 'thumbnail_url' => false, 'thumbnail_width' => false, 'thumbnail_height' => false, 'link' => false, 'source' => 'youtube');
                } else {
//.........这里部分代码省略.........
开发者ID:ritthai,项目名称:LMS,代码行数:101,代码来源:youtube.util.php

示例9: profiling_start

profiling_start('create regions');
foreach ($areas['Canada'] as $a) {
    Area::Create($a, $country_id);
}
profiling_end('create regions');
$area_id = Area::GetID('Ontario', $country_id);
profiling_start('create universities');
foreach ($universities['Canada']['Ontario'] as $uni) {
    University::Create($uni, $area_id);
}
profiling_end('create universities');
$code = "";
$title = "";
$descr = "";
$uni_id = University::GetID('University of Waterloo');
profiling_start('create courses');
foreach ($xml as $a) {
    if ($a['tag'] == "CODE") {
        $code = $a['value'];
    } else {
        if ($a['tag'] == "TITLE") {
            $title = $a['value'];
        } else {
            if ($a['tag'] == "DESCRIPTION") {
                $descr = $a['value'];
                $code = ltrim(rtrim($code));
                $title = ltrim(rtrim($title));
                $descr = ltrim(rtrim($descr));
                $cid = Comment::Create(array('subject' => $code, 'id' => 1));
                $cd = new CourseDefn(mysql_real_escape_string(htmlspecialchars($code)));
                $cd->title = db_real_escape_string(htmlspecialchars($title));
开发者ID:ritthai,项目名称:LMS,代码行数:31,代码来源:mysql_init.php

示例10: curl_multi_exec

                     $mcr = curl_multi_exec($mch, $active);
                     Error::generate('debug', 'starting');
                 } else {
                     // preempted
                     // lock *was* acquired if blocking
                     if ($blocking) {
                         db_end_transaction('primitive_cache', $md5top);
                     }
                     $n_preempted_reqs++;
                 }
                 profiling_end('start of cycle');
             }
         }
     }
 } else {
     profiling_start('IPC');
     foreach ($r as $s) {
         if ($s == $sock) {
             // new connection
             if (!($newsock = socket_accept($sock))) {
                 Error::generate('debug', "Error in classmate{$argv['1']}: " . socket_strerror(socket_last_error()));
             } else {
                 $clients[intval($newsock)] = $newsock;
                 $data[intval($newsock)] = '';
             }
         } else {
             // established connection
             if (($read = socket_read($s, 1024)) === false || $read == '') {
                 if ($read != '') {
                     Error::generate('debug', "Error in classmate{$argv['1']}: " . socket_strerror(socket_last_error()));
                 } else {
开发者ID:ritthai,项目名称:LMS,代码行数:31,代码来源:cache_course.php

示例11: generate

 public static function generate($priority, $error, $flags = 'none')
 {
     global $CONFIG;
     global $ROOT;
     profiling_start('error::generate');
     $class = '';
     if (!self::$logging_enabled) {
         goto end;
     }
     //$class .= 'hidden';
     if (is_string($priority)) {
         $priority = self::$PRIORITY[$priority];
     }
     if ($CONFIG['debug'] === false && $priority == self::$PRIORITY['debug']) {
         goto end;
     }
     if (session_id() != "" && isset($_SESSION['errors'])) {
         self::$errors = $_SESSION['errors'];
     }
     if ($flags & self::$FLAGS['single'] && count(self::$errors) > 0) {
         goto end;
     }
     if ($flags & self::$FLAGS['override'] && count(self::$errors) > 0) {
         self::$errors = array();
     }
     // format string
     $pname = 'notice';
     foreach (self::$PRIORITY as $k => $v) {
         if ($v == $priority) {
             $pname = $k;
             break;
         }
     }
     $bgcolour = self::$bgcolour;
     $fmt = "<div class=\"{$pname} {$class}\" style=\"background-color: {$bgcolour}\">%s</div>\r\n";
     // log it
     $fp = fopen($ROOT . '/admin/debug.html', 'a');
     static::_output($fp, $fmt, $priority, $error);
     fclose($fp);
     // behaviour on error
     switch ($priority) {
         case self::$PRIORITY['fatal']:
             die($error);
             break;
         case self::$PRIORITY['warn']:
         case self::$PRIORITY['notice']:
         case self::$PRIORITY['success']:
             array_push(self::$errors, array('priority' => $priority, 'msg' => $error));
             break;
         case self::$PRIORITY['prod_debug']:
         case self::$PRIORITY['suspicious']:
             $fp = fopen($ROOT . '/admin/debug_special.html', 'a');
             static::_output($fp, $fmt, $priority, $error);
             fclose($fp);
             break;
         case self::$PRIORITY['debug']:
             break;
     }
     if (session_id() != "") {
         $_SESSION['errors'] = self::$errors;
     }
     end:
     profiling_end('error::generate');
 }
开发者ID:ritthai,项目名称:LMS,代码行数:64,代码来源:error.class.php


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