6!: Time

>> << Ndx Usr Pri Phr Dic Rel Voc !: wd Help Dictionary

Time | 6!:

See also`9!:32` and`9!:33` .

`6!:0 y` | Current. The current time in order YMDHMS (with fractional seconds):
       6!:0 ''
    1998 3 10 23 21 14.468
`6!:1 y` | Session. Seconds since start of session
`[x] 6!:2 y` | Execute. Seconds to execute sentence`y` (mean of`x` times with default once). For example:
       a=:?50 50$100
       6!:2 '%.a'
    0.091
       10 (6!:2) '%.a'          NB. Mean time of 10 executions
    0.0771
       ts=: 6!:2 , 7!:2@]       NB. Time and space
       ts '%.a'
    0.08 369920
`6!:3 y` | Delay. Delay execution for`y` seconds. For example,`6!:3 (2.5)`
`6!:8 y` | Query Clock Frequency. Return the clock frequency, the number of clock counter values per second. (In Windows, the result of`QueryPerformanceFrequency`.)`` The argument`y` is ignored.
       6!:8 ''
    1.19318e6
`6!:9 y` | Query Clock Counter. Return the current clock counter (elapsed time) value. (In Windows, the result of`QueryPerformanceCounter`.)`` The argument`y` is ignored.
       6!:9 ''
    4.08486e9
       _10 [\ 2 -~/\ 6!:9"1 (101 0)$0
    9 7 7 6 7 5 7 6 6 7
    6 7 6 6 6 6 8 6 6 7
    6 6 7 6 6 7 6 6 6 6
    6 7 6 6 6 6 7 6 6 8
    6 7 6 6 6 7 6 6 6 7
    6 6 6 7 7 6 7 6 7 6
    6 6 6 7 6 6 6 6 7 6
    6 6 6 7 6 7 7 6 7 6
    6 6 6 6 7 6 6 6 7 6
    6 6 6 6 6 6 6 6 6 8
`[x] 6!:10 y` | Performance Monitor Data Area. Literal (character) vector`y` is to hold the fixed-sized records of “packed” performance monitor data; the old PM data area (if any) is released. The PM counter (see`6!:12`)`` is set to 0. If`y` is an empty vector, no PM data will be collected. `x` is a 2-element vector of control parameters;`0 0` is assumed if it is elided. `0{x` - what to record 0 - entry and exit 1 - entry and exit and all lines `1{x` - action on running out of space in`y` 0 - “wrap”, discard the oldest record 1 - “truncate”, discard the newest record The result is the number of records that will be held in`y`.
`6!:11 y` | Unpack PM Data. Unpack the PM data, resulting in a boxed vector of data columns: 0 name 1 locale where name is found 2 valence 3 line number`` (`_1` for entry;`_2` for exit) 4 space in use (bytes) 5 time (seconds) 6 list of names Columns 0 and 1 are indices into column 6. Columns 0 to 5 have the same number of (corresponding) elements. `y` are indices of the rows to be unpacked, where 0 is the oldest row (and`_1` is the newest row). All rows are selected if`y` is the empty vector. Rows in the result are always arranged from oldest to newest and no row is selected more than once.
`6!:12 y` | Add y to the PM Counter. PM data is recorded if the PM counter is greater than 0 and a PM data area is extant. (A non-empty PM data area must be specified before the PM counter can be changed.) The result is the value of the PM counter after the operation.
`6!:13 y` | PM Statistics. Produces a 6-element vector of the following information: 0 - what to record 0 - entry and exit 1 - entry and exit and all lines 1 - action on insufficient space 0 - wrap 1 - truncate 2 - the maximum number of records 3 - current number of records 4 - whether records have been lost 5 - current value of the PM counter If no PM data area has been specified the result is`6$0`.`` The argument`y` is ignored.

Further Examples:

       sum=: +/

       avg=: 3 : 0
    n=. #y.
    s=. sum y.
    s % n
    )

       1 (6!:10) 1e5$'x'
    3570
       (6!:12) 1
    1
       avg"1 ? 3 10$100
    65 64.4 64.3
       (6!:12) _1
    0

       x=. 6!:11 ''
       $&.> x
    +--+--+--+--+--+--+-+
    |21|21|21|21|21|21|3|
    +--+--+--+--+--+--+-+
       |: > 6{. x
    0 2 1 _1 1152 22582.5
    0 2 1  0 4224 22582.5
    0 2 1  1  576 22582.5
    1 2 1 _1  128 22582.5
    1 2 1 _2   64 22582.5
    0 2 1  2  128 22582.5
    0 2 1 _2    0 22582.5
    0 2 1 _1  128 22582.5
    0 2 1  0 4224 22582.5
    0 2 1  1  576 22582.5
    1 2 1 _1  128 22582.5
    1 2 1 _2   64 22582.5
    0 2 1  2  128 22582.5
    0 2 1 _2    0 22582.5
    0 2 1 _1    0 22582.5
    0 2 1  0 4224 22582.5
    0 2 1  1  576 22582.5
    1 2 1 _1  128 22582.5
    1 2 1 _2   64 22582.5
    0 2 1  2  128 22582.5
    0 2 1 _2    0 22582.5

       _5[\ 2 - ~/\ > 5{x
    4.52571e_5 2.09524e_5 1.50857e_5 1.67619e_5 9.21905e_6
    6.28571e_5 9.21905e_6 1.59238e_5 1.59238e_5 1.34095e_5
    1.00571e_5 1.00571e_5 5.61524e_5 7.54286e_6 1.59238e_5
    1.50857e_5 1.42476e_5 1.00571e_5 8.38095e_6 5.61524e_5

       > {: x
    +---+---+----+
    |avg|sum|base|
    +---+---+----+

       (6!:10) 1e5$'x'   NB. entry and exit only
    3570
       (6!:12) 1
    1
       avg"1 ? 3 10$100
    38.8 61.9 61.7
       (6!:12) _1
    0

       x=. 6!:11 ''
       |: > 6{.x
    0 2 1 _1  832 22681.5
    1 2 1 _1 4928 22681.5
    1 2 1 _2   64 22681.5
    0 2 1 _2  128 22681.5
    0 2 1 _1  128 22681.5
    1 2 1 _1 4928 22681.5
    1 2 1 _2   64 22681.5
    0 2 1 _2  128 22681.5
    0 2 1 _1    0 22681.5
    1 2 1 _1 4928 22681.5
    1 2 1 _2   64 22681.5
    0 2 1 _2  128 22681.5

       _5[\ 2 - ~/\ > 5{x
    7.12381e_5  1.50857e_5 6.70476e_5 9.21905e_6    3.52e_5
    1.00571e_5 0.000108952 7.54286e_6 3.93905e_5 1.08952e_5
    6.03428e_5           0          0          0          0

       6!:13 ''
    0 0 3570 12 0 0

       sum_ab_ =: +/

       sum_z_ =: sum_ab_

       avg_q_ =: 3 : 0
    tally=. #
    s=. sum y.
    n=. tally y.
    s % n
    )

       (6!:10) 1e5$'x'
    3570
       (6!:12) 1
    1
       avg_q_ i.12
    5.5

       (6!:12) _1
    0

       x=: 6!:11 ''
       (>{&>/0 6{x) ,. ' ' ,. (>{&>/1 6{x) ,. ' ' ,. ": ,. >3{x
    avg_q_  q  _1
    sum     q  _1
    sum_ab_ ab _1
    sum_ab_ ab _2
    sum     q  _2
    tally   q  _1
    tally   q  _2
    avg_q_  q  _2

       > 6{x
    +------+---+-------+-----+-+--+
    |avg_q_|sum|sum_ab_|tally|q|ab|
    +------+---+-------+-----+-+--+

>> << Ndx Usr Pri Phr Dic Rel Voc !: wd Help Dictionary