Ev EvStat::attr
(PECL ev >= 0.2.0)
EvStat::attr — Ev에서 가장 최근에 감지한 값을 반환합니다.
설명
public EvStat::attr(): array
Ev에서 가장 최근에 감지한 값의 배열을 반환합니다.
매개변수
이 함수에는 매개변수가 없습니다.
반환 값
Ev에서 가장 최근에 감지한 값이 있는 배열을 반환합니다(실제 통계 없이):
EvStat::attr()
에 의해 반환된 배열의 항목 키 목록
Key | 설명 |
---|---|
'dev'
|
ID of device containing file |
'ino'
|
inode number |
'mode'
|
protection |
'nlink'
|
number of hard links |
'uid'
|
user ID of owner |
'size'
|
total size, in bytes |
'gid'
|
group ID of owner |
'rdev'
|
device ID (if special file) |
'blksize'
|
blocksize for file system I/O |
'blocks'
|
number of 512B blocks allocated |
'atime'
|
time of last access |
'ctime'
|
time of last status change |
'mtime'
|
time of last modification |
자세한 내용은 stat(2)
매뉴얼 페이지를 참조하십시오.
Examples
예제 #1 Monitor changes of /var/log/messages
<?php
// Use 10 second update interval.
$w = new EvStat("/var/log/messages", 8, function ($w) {
echo "/var/log/messages changed\n";
$attr = $w->attr();
if ($attr['nlink']) {
printf("Current size: %ld\n", $attr['size']);
printf("Current atime: %ld\n", $attr['atime']);
printf("Current mtime: %ld\n", $attr['mtime']);
} else {
fprintf(STDERR, "`messages` file is not there!");
$w->stop();
}
});
Ev::run();
?>
기타
- EvStat::prev() - EvStat::attr이 반환한 이전 값 집합을 반환합니다.
- EvStat::stat() - 통계 호출을 시작합니다.