Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
ai
noblogs-wp
Commits
be2c708f
Commit
be2c708f
authored
Dec 25, 2013
by
godog
Committed by
kiki
May 21, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add xcache stats reporting
parent
74eebdf0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
0 deletions
+53
-0
xcache_stats_r2mon.php
xcache_stats_r2mon.php
+53
-0
No files found.
xcache_stats_r2mon.php
0 → 100644
View file @
be2c708f
<?php
$EXPORTED_STATS
=
array
(
"compiling"
,
"disabled"
,
"misses"
,
"hits"
,
"clogs"
,
"ooms"
,
"errors"
,
"cached"
,
"deleted"
,
"size"
,
"avail"
);
if
(
!
extension_loaded
(
'XCache'
))
{
trigger_error
(
"xcache not loaded"
,
E_USER_ERROR
);
header
(
"HTTP/1.1 500 Internal Server Error"
);
}
function
xcache_type_stats
(
$type
)
{
global
$EXPORTED_STATS
;
$total
=
array
();
$type_stats
=
array
();
for
(
$i
=
0
;
$i
<
xcache_count
(
$type
);
$i
++
)
{
$type_stats
[]
=
xcache_info
(
$type
,
$i
);
}
foreach
(
$type_stats
as
$unused
=>
$type_stat
)
{
foreach
(
$type_stat
as
$k
=>
$v
)
{
if
(
!
in_array
(
$k
,
$EXPORTED_STATS
))
{
continue
;
}
if
(
!
isset
(
$total
[
$k
]))
{
$total
[
$k
]
=
0
;
}
$total
[
$k
]
+=
$v
;
}
}
return
$total
;
}
$code_cache_stats
=
xcache_type_stats
(
XC_TYPE_PHP
);
$var_cache_stats
=
xcache_type_stats
(
XC_TYPE_VAR
);
/*
print var_dump($code_cache_stats);
print var_dump($var_cache_stats);
*/
foreach
(
$code_cache_stats
as
$k
=>
$v
)
{
print
"xcache.stat
{
type=code,what=$k
}
:
$v
\n
"
;
}
foreach
(
$var_cache_stats
as
$k
=>
$v
)
{
print
"xcache.stat
{
type=var,what=$k
}
:
$v
\n
"
;
}
print
"xcache.pid: "
.
getmypid
();
?>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment