略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: Procedural PECL/rrd example

2025-03-13

Procedural PECL/rrd example

示例 #1 Procedural usage of rrd

<?php
$rrdFile
= dirname(__FILE__) . "/speed.rrd";

//create rrd file
rrd_create($rrdFile,
array(
"--start",920804400,
"DS:speed:COUNTER:600:U:U",
"RRA:AVERAGE:0.5:1:24",
"RRA:AVERAGE:0.5:6:10"
)
);

//update rrd file
rrd_update($rrdFile,
array(
"920804700:12345",
"920805000:12357"
)
);

//graph output
rrd_graph(dirname(__FILE__) . "/speed.png",
array(
"--start", "920804400",
"--end", "920808000",
"--vertical-label", "m/s",
"DEF:myspeed=$rrdFile:speed:AVERAGE",
"CDEF:realspeed=myspeed,1000,*",
"LINE2:realspeed#FF0000"
)
);
?>
添加备注

用户贡献的备注

此页面尚无用户贡献的备注。

官方地址:https://www.php.net/manual/en/rrd.examples-procedural.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3