Ends pre-fetching of globals.
Description
$PREFETCHOFF turns off the pre-fetching of global nodes established by $PREFETCHON for the current process.
There are three forms of $PREFETCHOFF:
-
$PREFETCHOFF() turns off all pre-fetching established for the current process.
-
$PREFETCHOFF(gref) turns off pre-fetching of the gref node and all of its descendents. The gref value must correspond exactly to the $PREFETCHON value.
-
$PREFETCHOFF(gref,gref2) turns off pre-fetching of the nodes in the range gref through gref2. gref and gref2 must be nodes of the same global. The gref and gref2 values must correspond exactly to the $PREFETCHON values. You cannot turn off part of a range of values.
Upon successful completion, $PREFETCHOFF() returns 0. It returns 0 even if there were no pre-fetches to turn off.
Upon successful completion, $PREFETCHOFF(gref) and $PREFETCHOFF(gref,gref2) return a string of six integers separated by commas. These six values are: number of blocks prefetched, number of I/Os performed, number of prefetch operations, milliseconds of prefetch disk time, background job: number of blocks prefetched, and background job: number of I/Os performed.
Upon failure, all forms of $PREFETCHOFF return -1. $PREFETCHOFF(gref) and $PREFETCHOFF(gref,gref2) return -1 if there is no corresponding $PREFETCHON that exactly matches the specified global or range of globals, or if the specified prefetch global or range of globals has already been turned off.
Examples
The following example establishes two pre-fetches, then turns them off individually:
SET ret=$PREFETCHON(^a)
IF ret=1 { WRITE !,"prefetch established" }
ELSE { WRITE !,"prefetch not established" }
SET ret2=$PREFETCHON(^b)
IF ret2=1 { WRITE !,"prefetch established" }
ELSE { WRITE !,"prefetch not established" }
SET retoff=$PREFETCHOFF(^a)
IF retoff'=-1 { WRITE !,"prefetch turned off. Values:",retoff }
ELSE { WRITE !,"prefetch not turned off" }
SET retoff2=$PREFETCHOFF(^b)
IF retoff2'=-1 { WRITE !,"prefetch turned off. Values:",retoff2 }
ELSE { WRITE !,"prefetch not turned off" }
The following example establishes two pre-fetches, then turns off all pre-fetches for the current process:
SET ret=$PREFETCHON(^a)
IF ret=1 { WRITE !,"prefetch established" }
ELSE { WRITE !,"prefetch not established" }
SET ret2=$PREFETCHON(^b)
IF ret2=1 { WRITE !,"prefetch established" }
ELSE { WRITE !,"prefetch not established" }
SET retoff=$PREFETCHOFF()
IF retoff=0 { WRITE !,"all prefetches turned off" }
ELSE { WRITE !,"prefetch not turned off" }