晋太元中,武陵人捕鱼为业。缘溪行,忘路之远近。忽逢桃花林,夹岸数百步,中无杂树,芳草鲜美,落英缤纷。渔人甚异之,复前行,欲穷其林。 林尽水源,便得一山,山有小口,仿佛若有光。便舍船,从口入。初极狭,才通人。复行数十步,豁然开朗。土地平旷,屋舍俨然,有良田、美池、桑竹之属。阡陌交通,鸡犬相闻。其中往来种作,男女衣着,悉如外人。黄发垂髫,并怡然自乐。 见渔人,乃大惊,问所从来。具答之。便要还家,设酒杀鸡作食。村中闻有此人,咸来问讯。自云先世避秦时乱,率妻子邑人来此绝境,不复出焉,遂与外人间隔。问今是何世,乃不知有汉,无论魏晋。此人一一为具言所闻,皆叹惋。余人各复延至其家,皆出酒食。停数日,辞去。此中人语云:“不足为外人道也。”(间隔 一作:隔绝) 既出,得其船,便扶向路,处处志之。及郡下,诣太守,说如此。太守即遣人随其往,寻向所志,遂迷,不复得路。 南阳刘子骥,高尚士也,闻之,欣然规往。未果,寻病终。后遂无问津者。
|
Server : Apache System : Linux srv.rainic.com 4.18.0-553.47.1.el8_10.x86_64 #1 SMP Wed Apr 2 05:45:37 EDT 2025 x86_64 User : rainic ( 1014) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/akaindir/www/crm/libraries/adodb/perf/ |
Upload File : |
<?php
/*
@version v5.20.9 21-Dec-2016
@copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
@copyright (c) 2014 Damien Regad, Mark Newnham and the ADOdb community
Released under both BSD license and Lesser GPL library license.
Whenever there is any discrepancy between the two licenses,
the BSD license will take precedence. See License.txt.
Set tabs to 4 for best viewing.
Latest version is available at http://adodb.sourceforge.net
Library for basic performance monitoring and tuning
*/
// security - hide paths
if (!defined('ADODB_DIR')) die();
/*
Notice that PostgreSQL has no sql query cache
*/
class perf_postgres extends adodb_perf{
var $tablesSQL =
"select a.relname as tablename,(a.relpages+CASE WHEN b.relpages is null THEN 0 ELSE b.relpages END+CASE WHEN c.relpages is null THEN 0 ELSE c.relpages END)*8 as size_in_K,a.relfilenode as \"OID\" from pg_class a left join pg_class b
on b.relname = 'pg_toast_'||trim(a.relfilenode)
left join pg_class c on c.relname = 'pg_toast_'||trim(a.relfilenode)||'_index'
where a.relname in (select tablename from pg_tables where tablename not like 'pg_%')";
var $createTableSQL = "CREATE TABLE adodb_logsql (
created timestamp NOT NULL,
sql0 varchar(250) NOT NULL,
sql1 text NOT NULL,
params text NOT NULL,
tracer text NOT NULL,
timer decimal(16,6) NOT NULL
)";
var $settings = array(
'Ratios',
'statistics collector' => array('RATIO',
"select case when count(*)=3 then 'TRUE' else 'FALSE' end from pg_settings where (name='stats_block_level' or name='stats_row_level' or name='stats_start_collector') and setting='on' ",
'Value must be TRUE to enable hit ratio statistics (<i>stats_start_collector</i>,<i>stats_row_level</i> and <i>stats_block_level</i> must be set to true in postgresql.conf)'),
'data cache hit ratio' => array('RATIO',
"select case when blks_hit=0 then 0 else round( ((1-blks_read::float/blks_hit)*100)::numeric, 2) end from pg_stat_database where datname='\$DATABASE'",
'=WarnCacheRatio'),
'IO',
'data reads' => array('IO',
'select sum(heap_blks_read+toast_blks_read) from pg_statio_user_tables',
),
'data writes' => array('IO',
'select round((sum(n_tup_ins/4.0+n_tup_upd/8.0+n_tup_del/4.0)/16)::numeric,2) from pg_stat_user_tables',
'Count of inserts/updates/deletes * coef'),
'Data Cache',
'data cache buffers' => array('DATAC',
"select setting from pg_settings where name='shared_buffers'",
'Number of cache buffers. <a href=http://www.varlena.com/GeneralBits/Tidbits/perf.html#basic>Tuning</a>'),
'cache blocksize' => array('DATAC',
'select 8192',
'(estimate)' ),
'data cache size' => array( 'DATAC',
"select setting::integer*8192 from pg_settings where name='shared_buffers'",
'' ),
'operating system cache size' => array( 'DATA',
"select setting::integer*8192 from pg_settings where name='effective_cache_size'",
'(effective cache size)' ),
'Memory Usage',
# Postgres 7.5 changelog: Rename server parameters SortMem and VacuumMem to work_mem and maintenance_work_mem;
'sort/work buffer size' => array('CACHE',
"select setting::integer*1024 from pg_settings where name='sort_mem' or name = 'work_mem' order by name",
'Size of sort buffer (per query)' ),
'Connections',
'current connections' => array('SESS',
'select count(*) from pg_stat_activity',
''),
'max connections' => array('SESS',
"select setting from pg_settings where name='max_connections'",
''),
'Parameters',
'rollback buffers' => array('COST',
"select setting from pg_settings where name='wal_buffers'",
'WAL buffers'),
'random page cost' => array('COST',
"select setting from pg_settings where name='random_page_cost'",
'Cost of doing a seek (default=4). See <a href=http://www.varlena.com/GeneralBits/Tidbits/perf.html#less>random_page_cost</a>'),
false
);
function __construct(&$conn)
{
$this->conn = $conn;
}
var $optimizeTableLow = 'VACUUM %s';
var $optimizeTableHigh = 'VACUUM ANALYZE %s';
/**
* @see adodb_perf#optimizeTable
*/
function optimizeTable($table, $mode = ADODB_OPT_LOW)
{
if(! is_string($table)) return false;
$conn = $this->conn;
if (! $conn) return false;
$sql = '';
switch($mode) {
case ADODB_OPT_LOW : $sql = $this->optimizeTableLow; break;
case ADODB_OPT_HIGH: $sql = $this->optimizeTableHigh; break;
default :
{
ADOConnection::outp(sprintf("<p>%s: '%s' using of undefined mode '%s'</p>", __CLASS__, 'optimizeTable', $mode));
return false;
}
}
$sql = sprintf($sql, $table);
return $conn->Execute($sql) !== false;
}
function Explain($sql,$partial=false)
{
$save = $this->conn->LogSQL(false);
if ($partial) {
$sqlq = $this->conn->qstr($sql.'%');
$arr = $this->conn->GetArray("select distinct distinct sql1 from adodb_logsql where sql1 like $sqlq");
if ($arr) {
foreach($arr as $row) {
$sql = reset($row);
if (crc32($sql) == $partial) break;
}
}
}
$sql = str_replace('?',"''",$sql);
$s = '<p><b>Explain</b>: '.htmlspecialchars($sql).'</p>';
$rs = $this->conn->Execute('EXPLAIN '.$sql);
$this->conn->LogSQL($save);
$s .= '<pre>';
if ($rs)
while (!$rs->EOF) {
$s .= reset($rs->fields)."\n";
$rs->MoveNext();
}
$s .= '</pre>';
$s .= $this->Tracer($sql,$partial);
return $s;
}
}