Php and Sqlite3

nano /root/sensor.php
#!/usr/bin/php-cli
<?php
$then = microtime(true);
for ($x = 0; $x <= 1000; $x++) {
$db = new SQLite3('/root/sensor.db');
$result = $db->query('select temperature from sensor_data limit 1') or die('Query failed');
while ($row = $result->fetchArray())
{
  $temperature=$row['temperature'];
  //echo $temperature."\n";
}
$db->close();
}
$now = microtime(true);
echo  ($now-$then)."\n";
?>
chmod 755 /root/sensor.php
root@Arduino:~# /root/sensor.php
4.3555958271

Php and Sqlite3 profile speed is 4.35 ms

Comments powered by CComment