Beispiel #1
0
function __shutdown()
{
    global $time, $memory;
    $endTime = microtime(true);
    $endMemory = memory_get_usage();
    $duration = $endTime - $time;
    $hours = (int) ($duration / 60 / 60);
    $minutes = (int) ($duration / 60) - $hours * 60;
    $seconds = (int) $duration - $hours * 60 * 60 - $minutes * 60;
    $totalMemory = bytesToSize($endMemory - $memory);
    echo '
	Time [' . $hours . ":" . $minutes . ":" . $seconds . '] Memory [' . $totalMemory . ']\\n ';
}
Beispiel #2
0
function get_online_objects()
{
    $device_browser_list = mmc_array_values(NS_DEVICE_LIST);
    time_print('性能分析:取列表:');
    if (isset($_GET['debug'])) {
        $device_count = mmc_array_length(NS_DEVICE_LIST);
        $memcache_obj = new Memcache();
        $memcache_obj->connect(MEMC_HOST, MEMC_PORT);
        $stats = $memcache_obj->getStats();
        $memcache_obj->close();
        $dbg_print = '开始时间:' . getDateStyle($stats['time'] - $stats['uptime']);
        $dbg_print .= ' 使用内存: ' . bytesToSize($stats['bytes']) . '/' . bytesToSize($stats['limit_maxbytes']);
        $dbg_print .= '<br>清理时间:' . getDateStyle(async_timer('/on_timer_online_list.php'));
        $dbg_print .= ' 维护设备数: ' . $device_count . '  活跃设备数: ' . count($device_browser_list);
        $xmlStr = file_get_contents('http://' . $_SERVER['SERVER_NAME'] . '/channels-stats');
        $channels = json_decode($xmlStr);
        $dbg_print .= '<br>推送开始:' . getDateStyle(time() - $channels->uptime) . ' 频道数: ' . $channels->channels;
        $dbg_print .= ' 订阅数: ' . $channels->subscribers . ' 消息数: ' . $channels->published_messages;
        $dbg_print .= '<br>流程计数: ' . counter() . '<br>';
        echo $dbg_print;
    }
    /******************************************************
    	预处理:账户绑定列表
    	******************************************************/
    $aDataSet = [];
    foreach ($device_browser_list as $browser) {
        if (empty($browser)) {
            continue;
        }
        $account = @$browser['bind_account'];
        $device = $browser['device'];
        $useragent = $browser['UserAgent'];
        $ref_obj = $browser['Visiting'] ? parse_url($browser['Visiting']) : null;
        $visiting = @$ref_obj['host'];
        $is_mobile = $browser['ismobiledevice'] ? 'mobi' : 'desk';
        $aDataSet[] = [$account, $browser['region'], $visiting, $browser['browser'], $browser['platform'], $is_mobile, $browser['device_name'], $browser['device']];
    }
    time_print('整合:');
    if (isset($_GET['debug'])) {
        echo time_print();
    }
    return $aDataSet;
}
Beispiel #3
0
    ?>
</td>
							<td><?php 
    echo query_numrows("SELECT `serverid` FROM `" . DBPREFIX . "server` WHERE `boxid` = '" . $rowsBoxes['boxid'] . "'");
    ?>
</td>
							<td><?php 
    echo formatStatus(getStatus($rowsBoxes['ip'], $rowsBoxes['sshport']));
    ?>
</td>
							<td> RX:&nbsp;<?php 
    echo bytesToSize($cache["{$rowsBoxes['boxid']}"]['bandwidth']['rx_usage']);
    ?>
/s </td>
							<td> TX:&nbsp;<?php 
    echo bytesToSize($cache["{$rowsBoxes['boxid']}"]['bandwidth']['tx_usage']);
    ?>
/s </td>
							<td><span class="badge badge-<?php 
    if ($cache["{$rowsBoxes['boxid']}"]['cpu']['usage'] < 65) {
        echo 'info';
    } else {
        if ($cache["{$rowsBoxes['boxid']}"]['cpu']['usage'] < 85) {
            echo 'warning';
        } else {
            echo 'important';
        }
    }
    ?>
"><?php 
    echo $cache["{$rowsBoxes['boxid']}"]['cpu']['usage'];
      <tr>
        <td width="100%" colspan="4"><b>Site Statistics</b></td>
      </tr>
      <tr>
        <td width="25%">Total Uploads:</td>
        <td width="25%"><?php 
print mysql_num_rows($file_query);
?>
</td>
        <td width="25%">Active Uploads Size:</td>
        <td width="25%"><?php 
$totalsize = 0;
while ($file = mysql_fetch_array($file_query)) {
    $totalsize += $file['file_size'];
}
print bytesToSize($totalsize);
?>
</td>
     </tr>
      <tr>
        <td width="25%">Active Files:</td>
        <td width="25%"><?php 
print mysql_num_rows(mysql_query("SELECT * FROM `" . $table_prefix . "files` WHERE (`expiry` = '0' OR `expiry` >  '" . time() . "') AND (`deleted` = '0')"));
?>
 [ <a href="./manage_files.php">Manage</a> ]</td>
        <td width="25%"></td>
        <td width="25%"></td>
      </tr>
    </table>
  </div>
<?php 
Beispiel #5
0
     foreach ($disks as $disk) {
         $data['hosts'][$host['id']]['diskTotal'] += $disk->lastvalue;
     }
     $data['hosts'][$host['id']]['diskTotal'] = bytesToSize($data['hosts'][$host['id']]['diskTotal']);
     // AVAILABLE MEMORY
     if ($data['hosts'][$host['id']]['os'] == "Windows") {
         $key = "vm.memory.size[free]";
     } else {
         $key = "vm.memory.size[available]";
     }
     $memory = $api->itemGet(array("output" => "extend", "hostids" => $host['id'], "search" => array("key_" => $key)));
     $data['hosts'][$host['id']]['memory']['free'] = isset($memory[0]->lastvalue) ? bytesToSize($memory[0]->lastvalue) : 'n/a';
     // TOTAL MEMORY
     $memory = [];
     $memory = $api->itemGet(array("output" => "extend", "hostids" => $host['id'], "search" => array("key_" => "vm.memory.size[total]")));
     $data['hosts'][$host['id']]['memory']['total'] = isset($memory[0]->lastvalue) ? bytesToSize($memory[0]->lastvalue) : 'n/a';
     // INGRESS (download)
     $data['hosts'][$host['id']]['ingress'] = 0;
     $ingress = $api->itemGet(array("output" => "extend", "hostids" => $host['id'], "searchWildcardsEnabled" => true, "search" => array("key_" => "net.if.in[*]")));
     foreach ($ingress as $in) {
         $data['hosts'][$host['id']]['ingress'] += $in->lastvalue;
     }
     // EGRESS (upload)
     $data['hosts'][$host['id']]['egress'] = 0;
     $egress = $api->itemGet(array("output" => "extend", "hostids" => $host['id'], "searchWildcardsEnabled" => true, "search" => array("key_" => "net.if.out[*]")));
     foreach ($egress as $out) {
         $data['hosts'][$host['id']]['egress'] += $out->lastvalue;
     }
     $data['totals']['ingress'] += $data['hosts'][$host['id']]['ingress'];
     $data['totals']['egress'] += $data['hosts'][$host['id']]['egress'];
 }
Beispiel #6
0
        $url = wp_nonce_url(get_bloginfo('wpurl') . '/wp-admin/admin.php?page=wp-clone&del=' . $key, 'wpclone-submit');
        ?>
                <tr>
                    <th>Restore backup</th>

                    <td><input class="restoreBackup" name="restoreBackup" type="radio" value="<?php 
        echo $filename;
        ?>
" /></td>

                    <td>
                        <a href="<?php 
        echo $filename;
        ?>
" class="zclip"> (<?php 
        echo bytesToSize($backup['size']);
        ?>
)&nbsp;&nbsp;<?php 
        echo $backup['name'];
        ?>
</a>
                        <input type="hidden" name="backup_name" value="<?php 
        echo $filename;
        ?>
" />
                    </td>
                    <?php 
        if (isset($backup['log'])) {
            printf('<td><a href="%s">log</a></td>', convertPathIntoUrl(WPCLONE_DIR_BACKUP . $backup['log']));
        } else {
            echo '<td>&mdash;</td>';
Beispiel #7
0
									<?php 
echo bytesToSize($cache["{$rows['boxid']}"]['hdd']['total']);
?>
 <?php 
echo T_('total');
?>
,&nbsp;
									<?php 
echo bytesToSize($cache["{$rows['boxid']}"]['hdd']['used']);
?>
 <?php 
echo T_('used');
?>
,&nbsp;
									<?php 
echo bytesToSize($cache["{$rows['boxid']}"]['hdd']['free']);
?>
 <?php 
echo T_('free');
?>

								</td>
							</tr>
							<tr>
								<td><?php 
echo T_('Last Update');
?>
</td>
								<td><span class="label"><?php 
echo formatDate($cron['value']);
?>
Beispiel #8
0
                $Entry = "{$source}/{$entry}";
                if (is_dir($Entry)) {
                    wpa_copy($Entry, $target . '/' . $entry);
                } else {
                    $wp_filesystem->copy($Entry, $target . '/' . $entry, true, FS_CHMOD_FILE);
                }
            }
            $d->close();
        } else {
            $wp_filesystem->copy($source, $target, true);
        }
    }
}
/**
 * @since 2.0.6
 */
function wpa_replace_prefix($newPrefix)
{
    $wpconfig = wpa_wpconfig_path();
    global $wp_filesystem;
    if (!$wp_filesystem->is_writable($wpconfig)) {
Beispiel #9
0
        ?>
<br/>
                                            <br/>
                                            <a href="<?php 
        echo HOSTNAME . 'download.php?id=' . $books[$index]['id'];
        ?>
" target="new">
                                                <?php 
        echo '<sup>[' . strtoupper($books[$index]['file_type']) . ']</sup> Download';
        ?>
                                            </a><br/>
                                            <br/>
                                            <?php 
        if (is_file(ROOT . $books[$index]['link'])) {
            $size = filesize(ROOT . $books[$index]['link']);
            echo "Size: " . bytesToSize($size);
        }
        ?>
<br/>
                                            <br/>
                                            <div class="button" id="_<?php 
        echo $books[$index]['id'];
        ?>
editButton" onclick="editEbook('<?php 
        echo $books[$index]['id'];
        ?>
',
                                                                    '<?php 
        echo $books[$index]['title'];
        ?>
',
Beispiel #10
0
        ?>
            <div class="restore-backup-options">
                <strong>Restore backup </strong>

                <input class="restoreBackup" name="restoreBackup" type="radio"
                       value="<?php 
        echo $filename;
        ?>
" />&nbsp;

                <a href="<?php 
        echo $filename;
        ?>
" class="zclip">
                    (&nbsp;<?php 
        echo bytesToSize($row['backup_size']);
        ?>
&nbsp;)&nbsp; <?php 
        echo $row['backup_name'];
        ?>
                </a>&nbsp;|&nbsp;

                <input type="hidden" name="backup_name" value="<?php 
        echo $filename;
        ?>
" />

                <a class="copy-button" href="#" data-clipboard-text="<?php 
        echo $filename;
        ?>
" >Copy URL</a> &nbsp;|&nbsp;
Beispiel #11
0
 private function _processData($multiInfo)
 {
     $handleString = (string) $multiInfo['handle'];
     $this->info[$handleString]['multi'] = $multiInfo;
     $this->info[$handleString]['curl'] = curl_getinfo($multiInfo['handle']);
     $http_url = $this->info[$handleString]['url'];
     $http_code = $this->info[$handleString]['curl']['http_code'];
     $content_type = $this->info[$handleString]['curl']['content_type'];
     $content_length = $this->info[$handleString]['curl']['download_content_length'];
     $total_time = $this->info[$handleString]['curl']['total_time'];
     $starttransfer_time = $this->info[$handleString]['curl']['starttransfer_time'];
     $connect_time = $this->info[$handleString]['curl']['connect_time'];
     // $request_header = $this->info[$multiInfo['handle']]['curl']['request_header'];
     // print_r($this->info[$multiInfo['handle']]['curl']);
     // Close the file we're downloading into
     fclose($this->filehandles[$http_url]);
     $file_exists = file_exists($this->entries[$http_url]);
     $file_size = $file_exists ? filesize($this->entries[$http_url]) : 0;
     $color = 'pass';
     if ($http_code != 200) {
         $color = 'fail';
         $this->failures[$http_url] = "HTTP Error after " . $total_time . " seconds: " . $http_code;
         if ($http_code == 0) {
             $this->failures[$http_url] .= " (possibly too many concurrent connections).";
         }
         unlink($this->entries[$http_url]);
     } else {
         if (!$file_exists) {
             $color = 'fail';
             $this->failures[$http_url] = "Unable to save file after download. Maybe file name is too long?";
         } elseif ($file_size == 0) {
             // Delete it so that we have to download it again if the user refreshes
             unlink($this->entries[$http_url]);
             $color = 'fail';
             $this->failures[$http_url] = "The file is {$file_size} bytes in length.";
         }
         if ($content_length > $this->warningFileSize * 2) {
             $color = 'bigwarning';
         } elseif ($content_length > $this->warningFileSize) {
             $color = 'warning';
         }
         if ($total_time > 10) {
             $color = 'veryslowwarning';
         } elseif ($total_time > 5) {
             $color = 'slowwarning';
         }
     }
     $char = pugpig_get_download_char($content_type, 'MIME');
     _print_immediately('<a class="' . $color . '" href="' . $http_url . '" target="_blank" title="' . $http_url . ' [Response: ' . $http_code . ', Size: ' . $content_length . ' (' . bytesToSize($file_size) . '), Type: ' . $content_type . ', Time: ' . $total_time . ', TTFB: ' . $starttransfer_time . ', Connect Time: ' . $connect_time . '] ">' . $char . '</a>');
     $this->processedCount++;
     if ($this->processedCount % 100 == 0 || $this->processedCount == count($this->entries)) {
         _print_immediately("<br />");
     }
 }
Beispiel #12
0
							<div class="row" style="margin-bottom: 1.5rem; ">
								<!-- ingress (downloads) -->
								<div class="col-sm-6">
									<span style="color: #00ff00; ">
									<?php 
    echo bytesToSize($host['ingress']) . 'ps';
    ?>
 <i class="icon-down-dir"></i>
									</span>
								</div>

								<!-- egress (uploads) -->
								<div class="col-sm-6 text-right">
									<span style="color: #ff0000; ">
									<i class="icon-up-dir"></i> <?php 
    echo bytesToSize($host['egress']) . 'ps';
    ?>
									</span>
								</div>
							</div>
							<hr />
							<div class="row" style="font-size: 1.2rem; ">
								<!-- CPU -->
								<div class="col-xs-4 text-center">
									<span style="font-size: 1.6rem;">USED CPU</span><br />
									<?php 
    echo $host['cpuLoad'] . ' %';
    ?>
								</div>

								<!-- MEMORY -->
Beispiel #13
0
echo get_page_url("about", $CONF);
?>
" target="_blank">About Page</a> and choose a donation method at the bottom.
        </p>
        <br />
      <h2 class="text-center"><b>Statistics</b></h2>
        <hr>
        <div class="row">
          <div class="col-sm-6">
            <h3>Uploads</h3>
              <p>Number of Uploads: <?php 
echo count($upload_list);
?>
</p>
              <p>Total Size: <?php 
echo bytesToSize($total_size['TotalSize']);
?>
</p>
          </div>
          <div class="col-sm-6">
            <h3>Pastes</h3>
              <p>Number of Pastes: <?php 
echo $paste_list[0]['pid'];
?>
</p>
          </div>
        </div>
        <div class="row">
          <div class="col-sm-6">
            <h3>Users</h3>
              <p>Number of Users: <?php 
function getVSphereResourceDatastore()
{
    if ($GLOBALS['DATASTORE'] != "yes") {
        return;
    }
    //query all datastores
    $datastoreRecords = queryRecord("datastore", null, null, "a", "name", null);
    $count = $dsSize = $dsUsed = $dsReq = 0;
    $GLOBALS['jumpTagOutput'] .= "<a href=\"#ds\">Datastores</a></br>\n";
    $dsOutput = "<a name=\"ds\"></a>\n";
    $dsOutput .= "<b>Datastores</b>\n<table border=1>\n";
    $dsOutput .= "<tr><th>NAME</th><th>MOREF</th><th>ENABLED</th><th>TYPE</th><th>PROVISIONED</th><th>USED</th><th>REQUESTED</th><th>NUM OF PVDC</th><th>vCENTER</th></tr>\n";
    if (count($datastoreRecords) != 0) {
        foreach ($datastoreRecords as $ds) {
            $count++;
            $dsSize = str_replace("-", "", $ds->get_provisionedStorageMB() * 1048576);
            $dsUsed = str_replace("-", "", $ds->get_storageUsedMB() * 1048576);
            $dsReq = str_replace("-", "", $ds->get_requestedStorageMB() * 1048576);
            $dsOutput .= "<tr>\n";
            $dsOutput .= "<td>" . $ds->get_name() . "</td>";
            $dsOutput .= "<td>" . $ds->get_moref() . "</td>";
            $dsOutput .= $ds->get_isEnabled() ? "<td bgcolor=\"" . $GLOBALS['light_green'] . "\">true</td>" : "<td bgcolor=\"" . $GLOBALS['red'] . "\">false</td>";
            $dsOutput .= "<td>" . $ds->get_datastoreType() . "</td>";
            $dsOutput .= "<td>" . bytesToSize(str_replace("-", "", $ds->get_provisionedStorageMB()) * 1048576) . "</td>";
            $dsOutput .= "<td>" . bytesToSize(str_replace("-", "", $ds->get_storageUsedMB()) * 1048576) . "</td>";
            $dsOutput .= "<td>" . bytesToSize(str_replace("-", "", $ds->get_requestedStorageMB()) * 1048576) . "</td>";
            $dsOutput .= "<td>" . $ds->get_numberOfProviderVdcs() . "</td>";
            $dsOutput .= "<td>" . $ds->get_vcName() . "</td>";
            $dsOutput .= "</tr>\n";
        }
    }
    $dsOutput .= "</table></br>\n";
    $f = fopen($GLOBALS['report'], "a");
    fwrite($f, $dsOutput);
    fclose($f);
    $dsSizeTotal = bytesToSize($dsSize);
    $dsUsedTotal = bytesToSize($dsUsed);
    $dsReqTotal = bytesToSize($dsReq);
    $details = "<table border=1><tr><td><b>Requested:</b></td><td>" . $dsReqTotal . "</td><td><b>Used:</b></td><td>" . $dsUsedTotal . "</td><td><b>Total:</b></td><td>" . $dsSizeTotal . "</td><td></table>";
    $GLOBALS['summaryHeaderOutput'] .= "<tr><td><b>Datastore Count:</b></td><td>" . $count . "</td><td>" . $details . "</td></tr>\n";
}
function _package_edition_package_size($edition_tag)
{
    $base = _package_final_folder();
    $contents = _package_edition_package_contents($base, $edition_tag);
    $size = 0;
    if (isset($contents['html_size'])) {
        $size += (int) $contents['html_size'];
    }
    if (isset($contents['assets_size'])) {
        $size += (int) $contents['assets_size'];
    }
    return bytesToSize($size);
}
function dump_scoreboard($filename)
{
    global $score_board;
    global $SHOW_CODE;
    global $tmDeadline;
    $fp = fopen($filename, "w");
    if ($fp == false) {
        return;
    }
    fprintf($fp, "<html>\n");
    fprintf($fp, "<HEAD><title>Scoreboard View Result</title>\n");
    fprintf($fp, '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">');
    fprintf($fp, '<STYLE TYPE="text/css">');
    fprintf($fp, '.normal { background-color: rgb(255,255,255); color: rgb(60,60,60); } ');
    fprintf($fp, '.highlight { background-color: rgb(255,246,0);  color: rgb(0,0,0); }');
    fprintf($fp, '.cart { width: 100%; }');
    fprintf($fp, '.hasTooltip span {display: none;  color: #000;   text-decoration: none;   padding: 3px;}');
    fprintf($fp, '.hasTooltip:hover span {display: block;  position: absolute; background-color: #FF99CC; opacity:0.85; border: 0px;   margin-left: 80px; margin-top:15px;}');
    fprintf($fp, "</STYLE>\n\n");
    fprintf($fp, "</HEAD>\n");
    fprintf($fp, "<BODY><h2> </h2>\n");
    fprintf($fp, '<div style="text-align:center; font-size:24; font-family: tahoma; color: #003366"><!CODESENSOR_HW_NUM!>. <!CODESENSOR_HW_TITLE!></div>');
    fprintf($fp, '<div style="text-align:center; font-size:16; font-family: sans-serif; color: #FF0066"><br/>Deadline: %s</div>', date('Y-n-j H:i:s', $tmDeadline));
    fprintf($fp, '<div  style="font-family:arial; font-size:16; text-align:right; font-style:italic; color: gray" >generated at : %s</div>', date('Y-n-j H:i:s'));
    fprintf($fp, '<table border=5 width=100%%  style="font-family: sans-serif" >');
    if (count($score_board) > 0) {
        $key_order = array();
        /*		
        		for ( $k = 0; $k < count($score_board[0]); $k++)
        			$key_order[$k] = null;
        */
        $key_order[0] = "id";
        $key_order[1] = "check";
        $key_order[2] = "I_refs";
        $key_order[3] = "cpu_time";
        $key_order[4] = "m_peak";
        $key_order[5] = "heap_lost";
        $key_order[6] = "m_error";
        $key_order[7] = "gcc";
        $key_order[8] = "illegal_func";
        $key_order[9] = "illegal_header";
        $key_order[10] = "lang";
        /// fill the unspecified ones
        foreach ($score_board[0] as $key => $value) {
            if (in_array($key, $key_order) == false) {
                $key_order[count($key_order)] = $key;
            }
        }
        //		var_dump($key_order);
        /// printe header
        fprintf($fp, "<tr>  ");
        foreach ($key_order as $key => $value) {
            if (dump_scoreboard_hide_key($value)) {
                goto skip;
            }
            switch ($value) {
                case "illegal_header":
                    $value = "i.h.";
                    break;
                case "illegal_func":
                    $value = "i.f.";
                    break;
                case "m_error":
                    $value = "m.e.";
                    break;
                case "m_heap_extra":
                    $value = "m_heap_e";
                    break;
                case "heap_lost":
                    $value = "lost";
                    break;
                case "missing":
                    $value = "?";
                    break;
                case "m_total":
                    goto skip;
                default:
                    break;
            }
            fprintf($fp, "<th>%s</th>", $value);
            skip:
        }
        fprintf($fp, "</tr>\n");
        ///// print entries
        for ($k = 0; $k < count($score_board); $k++) {
            if (GetSubmissionTime($score_board[$k]['id']) > $tmDeadline) {
                fprintf($fp, "<tr style=\"background-color: #66FF66\">");
            } else {
                fprintf($fp, "<tr onMouseOver=\"this.className='highlight'\" onMouseOut=\"this.className='normal'\">");
            }
            $id = $score_board[$k]['id'];
            foreach ($key_order as $tmp => $key) {
                if (dump_scoreboard_hide_key($key)) {
                    goto skip_data_col;
                }
                if (array_key_exists($key, $score_board[$k]) == false) {
                    printf("Error! missing entry " . $key . " in scoreboard at id=%s\n", $score_board[$k]["id"]);
                    exit(-1);
                }
                $value = $score_board[$k][$key];
                if ($key == "id" && $SHOW_CODE) {
                    fprintf($fp, "<td align=center><a href=\"%s/code/code.html\">%s</a></td>", $id, $value);
                } else {
                    if ($key == "m_total") {
                        goto skip_data_col;
                        /*
                        					settype($value,"float");
                        					
                        					if ( $SHOW_CODE) {
                        						fprintf($fp, "<td align=center><a href=\"%s/valgrind.massif_out_ms_print.report.final\">%.3e</a></td>", $id, $value);
                        					}
                        					else {
                        						fprintf($fp, "<td align=center>%.3e</td>", $value);
                        					}
                        */
                    } else {
                        if ($key == "score") {
                            $v = is_float($value) ? round($value) : $value;
                            fprintf($fp, '<td align=center style="color:#FF0000;">%d</td>', $v);
                        } else {
                            if ($key == "p_score") {
                                $v = is_float($value) ? round($value) : $value;
                                fprintf($fp, '<td align=center class="hasTooltip"><span>p_score</span>  %d  </td>', $v);
                            } else {
                                if ($key == "priority") {
                                    if (is_float($value)) {
                                        fprintf($fp, '<td align=center class="hasTooltip"><span>priority</span>%.3f</td>', round($value, 3));
                                    } else {
                                        fprintf($fp, '<td align=center class="hasTooltip"><span>priority</span>%d</td>', $value);
                                    }
                                } else {
                                    if ($key == "I_refs") {
                                        if ($SHOW_CODE) {
                                            fprintf($fp, '<td align=center class="hasTooltip"><span>I_refs</span><a href="%s/callgrind/code.html">%s</a></td>', $id, IrCntAbbrev($value));
                                            //fprintf($fp, "<td align=center><a href=\"%s/callgrind/code.html\">%s</a></td>", $id, number_format($value));
                                        } else {
                                            fprintf($fp, '<td align=center class="hasTooltip"><span>I_refs</span>%s</td>', IrCntAbbrev($value));
                                            //fprintf($fp, "<td align=center>%s</td>", number_format($value));
                                        }
                                    } else {
                                        if ($key == "cpu_time") {
                                            fprintf($fp, '<td align=center class="hasTooltip"><span>cpu_time</span>%s</td>', TimeAbbrev($value));
                                        } else {
                                            if ($key == "m_peak") {
                                                fprintf($fp, '<td align=center class="hasTooltip"><span>m_peak</span>%s</td>', bytesToSize($value));
                                            } else {
                                                if ($key == "maxrss") {
                                                    fprintf($fp, '<td align=center class="hasTooltip"><span>maximum resident set size</span>%s</td>', bytesToSize($value));
                                                } else {
                                                    if ($key == "flt") {
                                                        fprintf($fp, '<td align=center class="hasTooltip"><span>flt (# of page faults)</span>%s</td>', IrCntAbbrev($value));
                                                    } else {
                                                        if ($key == "diversity") {
                                                            fprintf($fp, '<td align=center class="hasTooltip"><span>diversity</span>%.2f</td>', round($value, 2));
                                                        } else {
                                                            if ($key == "func") {
                                                                fprintf($fp, '<td align=center class="hasTooltip"><span>functionality</span>%.3f</td>', round($value, 3));
                                                            } else {
                                                                if ($key == "missing") {
                                                                    fprintf($fp, '<td align=center class="hasTooltip"><span># of missing entries</span>%d</td>', $value);
                                                                } else {
                                                                    if ($key == "lang") {
                                                                        fprintf($fp, '<td align=center class="hasTooltip"><span>language</span>%s</td>', $value);
                                                                    } else {
                                                                        if ($key == "illegal_header") {
                                                                            fprintf($fp, '<td align=center class="hasTooltip"><span># of illegal header inclusions</span>%d</td>', $value);
                                                                        } else {
                                                                            if ($key == "illegal_func") {
                                                                                fprintf($fp, '<td align=center class="hasTooltip"><span># of illegal function usages</span>%d</td>', $value);
                                                                            } else {
                                                                                if ($key == "gcc") {
                                                                                    fprintf($fp, '<td align=center class="hasTooltip"><span>gcc compilation exit code</span>%d</td>', $value);
                                                                                } else {
                                                                                    if ($key == "m_error") {
                                                                                        fprintf($fp, '<td align=center class="hasTooltip"><span># of memory errors</span>%d</td>', $value);
                                                                                    } else {
                                                                                        if ($key == "heap_lost") {
                                                                                            fprintf($fp, '<td align=center class="hasTooltip"><span>heap lost</span>%s</td>', bytesToSize($value));
                                                                                        } else {
                                                                                            if ($key == "check") {
                                                                                                if (is_numeric($value) && $value >= 0) {
                                                                                                    fprintf($fp, '<td align=center class="hasTooltip"><span>check</span>%.2f</td>', round($value, 2));
                                                                                                } else {
                                                                                                    fprintf($fp, '<td align=center class="hasTooltip"><span>check</span>-1</td>');
                                                                                                }
                                                                                            } else {
                                                                                                if (is_float($value)) {
                                                                                                    fprintf($fp, "<td align=center>%.2f</td>", round($value, 2));
                                                                                                } else {
                                                                                                    fprintf($fp, "<td align=center>%s</td>", $value);
                                                                                                }
                                                                                            }
                                                                                        }
                                                                                    }
                                                                                }
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                skip_data_col:
            }
            fprintf($fp, "</tr>\n");
        }
    }
    fprintf($fp, "</table>\n");
    ///////////////////////////////////
    //fprintf($fp, '<iframe src="https://sensecloud.cs.nctu.edu.tw/smarttext/" width="100%%" height="60" frameBorder="0"  align="left" SCROLLING=NO></iframe>');
    ///////////////////////////////////////
    global $baseI;
    global $baseCPU_TIME;
    global $baseM;
    global $baseFLT;
    global $baseMAXRSS;
    global $TOTAL_P_SCORE;
    global $score_P_ratio;
    global $REMAINING_P_SCORE;
    global $NUM_OF_SUBMISSION;
    global $NUM_OF_EFFECTIVE_SUBMISSION;
    global $USE_SCALABLE_TOTAL_P_SCORE;
    global $DIVERSITY_MULTIPLIER;
    fprintf($fp, "<br/>number of submission = %d<br/>", $NUM_OF_SUBMISSION);
    fprintf($fp, "<br/>number of effective submission (priority>0) = %d<br/>", $NUM_OF_EFFECTIVE_SUBMISSION);
    if ($USE_SCALABLE_TOTAL_P_SCORE) {
        fprintf($fp, "<br/>total p_score = (%d * 80) = %d<br/>", $NUM_OF_EFFECTIVE_SUBMISSION, $TOTAL_P_SCORE);
    }
    fprintf($fp, "<br/>remaining p_score = %.2f<br/><br/>", $REMAINING_P_SCORE);
    fprintf($fp, "<br/><a href=\"code_sensor_fields_meanining.htm\">Field Definitions</a><br/><br/>");
    //fprintf($fp, "<br/><br/>total_score = %d<br/>\n", $TOTAL_P_SCORE);
    fprintf($fp, "<br/><br/><br/>if (gcc | illegal_func | illegal_header | missing),<br/>");
    fprintf($fp, " &nbsp;  &nbsp; priority = 0<br/>");
    fprintf($fp, " &nbsp;  &nbsp; func = 0<br/>");
    fprintf($fp, "else,<br/>");
    fprintf($fp, " &nbsp;  &nbsp; func = check * (0.95^m_error)<br/>");
    fprintf($fp, " &nbsp;  &nbsp; if ( check==1 ),<br/>");
    fprintf($fp, " &nbsp;  &nbsp; &nbsp; &nbsp; perf_I1 = lg(2+%d)/lg(2+I_refs) <br/>", $baseI);
    fprintf($fp, " &nbsp;  &nbsp; &nbsp; &nbsp; perf_I2 = lg(2+%d)/lg(2+cpu_time) )<br/>", $baseCPU_TIME);
    fprintf($fp, " &nbsp;  &nbsp; &nbsp; &nbsp; perf_I = (perf_I1>0) ? perf_I1 :  perf_I2<br/>", $baseCPU_TIME);
    fprintf($fp, " &nbsp;  &nbsp; &nbsp; &nbsp; priority = perf_I * max( lg(2+%d)/lg(2+m_peak) , lg(2+%d*%d)/lg(2+flt*maxrss) )<br/>", $baseM, $baseFLT, $baseMAXRSS);
    //	fprintf($fp, " &nbsp;  &nbsp; &nbsp; &nbsp; priority = lg( _pri+2 ) <br/>",  ($baseI), ($baseCPU_TIME));
    fprintf($fp, " &nbsp;  &nbsp; else,<br/>");
    fprintf($fp, " &nbsp;  &nbsp; &nbsp; &nbsp; priority = 0<br/>", $baseI, $baseM);
    fprintf($fp, "<br/>p_score = <a href=\"CreateScoreboard_release.html\">schedule</a>(%d, priority)<br/><br/>", $TOTAL_P_SCORE);
    fprintf($fp, "if (m_peak > 0),<br/>");
    fprintf($fp, " &nbsp;  &nbsp; func *=  (m_peak-heap_lost)/m_peak<br/><br/>");
    fprintf($fp, "diversity = -ln(  [number of effective submissions using the same language] / [number of effective submissions] ) * %.2f<br/><br/>", $DIVERSITY_MULTIPLIER);
    fprintf($fp, "score = min( func*(%.2f*100 + %.2f*p_score + diversity), 100)<br/>", 1 - $score_P_ratio, $score_P_ratio);
    ///////////////////////////////////
    fprintf($fp, "</body></html>\n");
    fclose($fp);
}
while ($files_row = mysql_fetch_array($files_result)) {
    ?>
      <tr class="file">
        <td align="center" valign="top" style="border-top: 1px dashed grey; padding: 5px 5px 5px 5px;"><?php 
    print $files_row['access_id'];
    ?>
</td>
        <td align="center" valign="top" style="border-top: 1px dashed grey; padding: 5px 5px 5px 5px;"><acronym title="<?php 
    print $files_row['file_name'];
    ?>
"><?php 
    print shorten_title($files_row['file_name']);
    ?>
</acronym></td>
        <td align="center" valign="top" style="border-top: 1px dashed grey; padding: 5px 5px 5px 5px;"><?php 
    print bytesToSize($files_row['file_size']);
    ?>
</td>
        <td align="center" valign="top" style="border-top: 1px dashed grey; padding: 5px 5px 5px 5px;"><?php 
    print date("M j, Y, g:i A", $files_row['timestamp']);
    ?>
</td>
        <td align="center" valign="top" style="border-top: 1px dashed grey; padding: 5px 5px 5px 5px;"><?php 
    print $files_row['ip_address'];
    ?>
</td>
        <td align="center" valign="top" style="border-top: 1px dashed grey; padding: 5px 5px 5px 5px;"><a href="./download_file.php?access_id=<?php 
    print $files_row['access_id'];
    ?>
" style="color: green;">Download</a> / <a href="./delete_file.php?access_id=<?php 
    print $files_row['access_id'];
Beispiel #18
0
function wpa_wpc_get_filelist($path, $exclude, $skip = false)
{
    $i = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path, FilesystemIterator::CURRENT_AS_SELF | FilesystemIterator::UNIX_PATHS | FilesystemIterator::SKIP_DOTS));
    $skipped = 0;
    $size = 0;
    $files = 0;
    $list = array();
    foreach ($i as $file => $info) {
        $file = wpCloneSafePathMode($file);
        if (false !== strpos($file, WPCLONE_DIR_BACKUP)) {
            continue;
        }
        if (false !== strpos($file, WPCLONE_DIR_PLUGIN)) {
            continue;
        }
        if (!empty($exclude) && wpa_wpc_strpos_array($exclude, $file)) {
            $skipped++;
            wpa_wpc_log(sprintf('file is inside an excluded directory, and it will not be included in the backup - "%s"', str_replace(WPCLONE_ROOT, '**SITE-ROOT**/', $file)));
            continue;
        }
        if ($skip && $info->getSize() > $skip) {
            $skipped++;
            wpa_wpc_log(sprintf('file skipped, file is larger than %s - "%s"  %s', bytesToSize($skip), str_replace(WPCLONE_ROOT, '**SITE-ROOT**/', $file), bytesToSize($info->getSize())));
            continue;
        }
        if ($info->isFile()) {
            $list[] = $file;
            $files++;
            $size += $info->getSize();
        }
    }
    if ($skipped > 0) {
        wpa_wpc_log(sprintf('%d files were excluded from the backup', $skipped));
    }
    wpa_wpc_log(sprintf('number of files to include in the archive is %d, and their uncompressed size is %s', $files, bytesToSize($size)));
    return $list;
}