System Function MF

From NARS2000
Jump to: navigation, search

Contents

⎕MF - Monitor Function

This function is available in both monadic and dyadic forms.

Monadic Function, Numeric Argument

Z←⎕MF R Sets or returns and sets a property of monitoring functions
R   is an integer singleton (¯2, ¯1, 1, 2, or 3)
Z   is a numeric scalar specific to the value of R


 R Effect Z
¯2 (None) Returns the Timer Source currently in use
The default value is 3 (Performance Timer scaled to milliseconds — Scaled Performance)
¯1 (None) Returns the current tick frequency in milliseconds
 1 Sets the new Timer Source to the Millisecond Timer Returns the old timer source (1, 2, or 3)
 2 Sets the new Timer Source to the Performance Timer Returns the old timer source (1, 2, or 3)
 3 Sets the new Timer Source to the Performance Timer scaled to milliseconds (Scaled Performance) Returns the old timer source (1, 2, or 3)


There are three Timer Sources available for timing functions:

  • 1: Millisecond Timer, in units of a millisecond (Integers)
  • 2: Performance Timer dependent on the computer hardware and the Operating System (raw data) (Integers)
  • 3: Performance Timer dependent on the computer hardware and the Operating System, but scaled to units of milliseconds (Scaled Performance) (Floating Point numbers)

The expression ⎕MF ¯2 returns the current Timer Source (1, 2, or 3). Typically, you should use a Timer Source of 3 as it uses the highest precision Timer Frequency and returns its result in easily understood units of milliseconds. Under Windows, Timer Sources 2 and 3 both obtain their timing data from the function QueryPerformanceCounter which has a resolution of one microsecond or better.

The expression ⎕MF ¯1 returns the number of milliseconds per unit. For the Millisecond timer, this value is 1.0. For the other two timers, it varies based on the computer hardware and the Operating System. Under Windows, it uses the function QueryPerformanceFrequency — to obtain the number of clock ticks per second, use 1000÷⎕MF ¯1.


Monadic Function, Character Argument

Z←⎕MF R returns the Monitor Data for the function named in R
R   is a character scalar or vector
Z   is a 3-column numeric vector of Monitor Data, one row per function line including the function header

The columns of the result as as follows:

  • [1] time of execution on this line including subfunctions
  • [2] always 0
  • [3] count of the number of times this line was executed

The first column of the result is a floating point number if the Timer Source is Scaled Performance (type 3), integer otherwise.

The first row of the result applies to the function header where its first element is the sum of the Timer Values of all lines in the function.


Dyadic Function

L ⎕MF R Enables or disable Function Monitoring
L   is a Boolean singleton
R   is a character scalar or vector of zero or more function names.
Z   is a Boolean vector one element per function named in R indicating the success (1) or failure (0) of the operation.

Function Monitoring is turned on (L=1) or off (L=0) for each of the functions named in R. For either value of L, all of the internal counters for each function are set to zero.

System Variables (A value may be assigned to these except for ⎕DM)
ALX CT DM DT ELX FC FEATURE FPC IC IO
LR LX PP PR PW RL SA WSID
Niladic System Functions (a value cannot be assigned to these)
A AV EM ET LC NNAMES NNUMS SI SYSID SYSVER
T TC TCBEL TCBS TCESC TCFF TCHT TCLF TCNL TCNUL
TS WA
Monadic or dyadic system functions (a value cannot be assigned to these)
AT CR DC DL DR EA EC ERROR ES EX
FMT FX MF NAPPEND NC NCREATE NERASE NINFO NL NLOCK
NREAD NRENAME NREPLACE NRESIZE NSIZE NTIE NUNTIE STOP TF TRACE
UCS VR
Note that quad functions and variables (except for the ⎕A family of functions) are case insensitive


See Also
System Commands System Variables and Functions Operators
Keyboard
A+S
Alt ¨ ¯ < > × ÷
Sh ~ ! @ # $ % ^ & * ( ) _ +
Key ` 1 2 3 4 5 6 7 8 9 0 - =
A+S
Alt ? π
Sh Q W E R T Y U I O P { } |
Key q w e r t y u i o p [ ] \
A+S §
Alt
Sh A S D F G H J K L : "
Key a s d f g h j k l ; '
A+S
Alt
Sh Z X C V B N M < > ?
Key z x c v b n m , . /
NARS 2000 Lang
Tool
Bar
+ - × ÷ * ! ? |
= < >
~ § π .. ,
/ \ ¨ .
_ ¯ b e g p r v x