elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Entrar al Canal Oficial Telegram de elhacker.net


+  Foro de elhacker.net
|-+  Programación
| |-+  Desarrollo Web
| | |-+  PHP (Moderador: #!drvy)
| | | |-+  Medidor de velocidad en php
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Medidor de velocidad en php  (Leído 8,103 veces)
dark_sargon


Desconectado Desconectado

Mensajes: 534


CJ


Ver Perfil WWW
Medidor de velocidad en php
« en: 4 Noviembre 2006, 00:14 am »

Hola, me gustaría saber si alguien tiene un código para poner en mi web de un medidor de descrga y subida preferiblemente en php  :P

Muchas gracias  :D


En línea

http://www.actimediaonline.com
Diseño Web, animación y más.

http://www.ciudadoscura.com
Diseño Web, electrónica, programación, móviles y más.
Ertai
Colaborador
***
Desconectado Desconectado

Mensajes: 2.025


Ralph Wiggum


Ver Perfil
Re: Medidor de velocidad en php
« Respuesta #1 en: 10 Noviembre 2006, 00:40 am »

Pues aquí tienes uno sacado de:

http://jan.moesen.nu/code/php/speedtest/

Se basa en cargar 512 Kb de comentarios en HTML y luego a partir del tiempo tardado, calcula la velocidad.

Hay bastante mejores pero no en PHP, hay uno en Java en:

http://www.auditmypc.com/speedtest.asp

Te dejo el código  :P

Código:
<?php
if ($_GET['source'])
{
    highlight_file($_SERVER['SCRIPT_FILENAME']);
    exit;
}

$maxNumKB = 4096;
$defNumKB = 512;
if (!isset($_GET['numKB']) || intval($_GET['numKB']) > $maxNumKB)
{
    header("Location: http://{$_SERVER['HTTP_HOST']}{$_SERVER['PHP_SELF']}?numKB=$defNumKB");
}
$numKB = intval($_GET['numKB']);
?>
<!DOCTYPE html
     PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>Jan! &raquo; PHP &raquo; speed test</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <style type="text/css">
    <!--
    html
    {
        font-family: sans-serif;
        color: #000;
        background: #fff;
    }
    *
    {
        font-size: medium;
    }
    #wait
    {
        border-bottom: thin dotted black;
    }
    #wait abbr
    {
        border: none;
    }
    #done
    {
        font-weight: bold;
    }
    #benchmark
    {
        padding: 1em;
        border: 1px solid black;
        background: #ffe;
        color: #000;
    }
    //-->
    </style>
</head>
<body>
<div id="benchmark">
<p>
    <strong>This not a script to benchmark or determine the execution speed
    of PHP scripts.</strong> If you're looking for one, check out the PEAR
    <a href="http://pear.php.net/package/Benchmark">Benchmark package</a>.
</p>
<p>
    This script sends <?php echo $numKB; ?> <abbr title="kilobyte">KB</abbr>
    of HTML comments to your client. Parsing that HTML may add to the total
    transfer time, so don't take this as your raw download speed.
</p>
</div>
<h1>Please wait</h1>
<p>
    <a href="<?php echo "http://{$_SERVER['HTTP_HOST']}{$_SERVER['PHP_SELF']}?source=1"; ?>">(Show source)</a>
</p>
<p id="wait">
    Transferring <?php echo $numKB; ?> <abbr title="kilobyte">KB</abbr>
</p>
<!--
<?php
function getmicrotime()
{
    list($usec, $sec) = explode(" ", microtime());
    return ((float)$usec + (float)$sec);
}

flush();
$timeStart = getmicrotime();
$nlLength = strlen("\n");
for ($i = 0; $i < $numKB; $i++)
{
    echo str_pad('', 1024 - $nlLength, '/*\\*') . "\n";
    flush();
}
$timeEnd = getmicrotime();
$timeDiff = round($timeEnd - $timeStart, 3);
?>
-->
<p id="done">
    <?php
        echo "Transferred {$numKB} <abbr title=\"kilobyte\">KB</abbr> in {$timeDiff} seconds, " .
             ($timeDiff <= 1 ? "more than {$numKB}" : round($numKB / $timeDiff, 3)) .
             ' <abbr title="kilobytes per second">KB/s</abbr>';
    ?>
</p>
</body>
</html>


En línea

Si la felicidad se comprara, entonces el dinero sería noble.

Código:
void rotar_by_ref(int& a, int& b) {
   /* Quien dijo que no se podia sin una variable temporal? */
   *a = *a ^ *b;
   *b = *a ^ *b;
   *a = *a ^ *b;
}
Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Medidor de distancias láser
Electrónica
alfafa 0 4,577 Último mensaje 16 Febrero 2011, 20:45 pm
por alfafa
Ayuda programa medidor de RAM
Java
PANCHIN123 2 2,326 Último mensaje 26 Abril 2012, 04:03 am
por #Hianpaz
Medidor de rendimiento CineBench (bench-mark)
Hardware
OLM 2 2,513 Último mensaje 22 Mayo 2012, 11:03 am
por OLM
Hackear Medidor Electrico Digital
Hacking Wireless
skynet777 8 51,680 Último mensaje 15 Octubre 2022, 18:44 pm
por juanelodi
Detector de silencio o medidor de amplitud de microfono
Scripting
Juancfernandez 2 6,165 Último mensaje 4 Noviembre 2019, 20:14 pm
por @XSStringManolo
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines