advise#
Tell the kernel how the mapped region will be accessed.
תקציר#
advise $map, 'sequential';
advise $map, 'willneed';
ארגומנטים#
$lvalue- a currently mapped scalar.$advice- a string naming an access pattern.
The portable values are:
'normal'- no particular pattern (the default).'random'- access order is unpredictable.'sequential'- read start to end once.'willneed'- prefault pages that will be needed soon.'dontneed'- release pages that will not be needed soon.
On Linux additional values are accepted: 'remove', 'dontfork', 'dofork', 'mergeable', 'unmergeable', 'free'. Unknown values are silently ignored.
דוגמאות#
Hint that a large log file will be scanned top to bottom:
map_file my $log, 'huge.log';
advise $log, 'sequential';
while ($log =~ /^(ERROR:.*)/mg) { ... }
מקרי קצה#
Advising an unmapped scalar raises an exception.
Advising an empty mapping is a no-op.
adviseis a hint to the kernel; it may do nothing on some systems.
הבדלים מן ה-upstream#
Fully compatible with upstream File::Map 0.71.
ראו גם#
protect- change read/write permissions rather than access hints.sync- control flush timing explicitly.