Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Swift における経過時間の計測

Swift における経過時間の計測

Yuto Mizutani

March 19, 2019
Tweet

More Decks by Yuto Mizutani

Other Decks in Technology

Transcript

  1. ໰୊ Start Time: 20XX/XX/XX 14:01:07 End Time: 20XX/XX/XX 14:17:47 Session:

    1 Training: Magazine Training VT value: 20000 List of events: 99: 1000808 END OF THE SESSION Responses: 0 Responses(ITI): 0 Reinforcers: 40 1,000,000 ms (1000 ඵ㲈16෼) Ͱ ऴΘͬͯཉ͍͠ͷʹ ऴྃ·Ͱʹ 808 ms ஗Ԇ͢Δ ! ࣮ࡍͷσʔλ͔Βൈਮͨ͠΋ͷɻ࣮ݧϓϩάϥϜʹ͸ Visual Basic 2015® Λ࢖༻ͨ͠ɻ ࣮ݧσʔλ -> σʔλ෼ੳʹෆศ
  2. ͜Ε·Ͱ (γϯάϧεϨου) 1000 ms + 1 ms 1000 ms +

    1 ms 1000 ms + 1 ms 3000 ms + 3 ms ஗Ԇ͕ੵΈॏͳΓऴྃ࣌ؒʹӨڹ
  3. • time() • Date • gettimeofday() • clock_gettime() • clock_gettime_nsec_np()

    • mach_absolute_time() Swift ʹ͓͚Δ ൓Ԡ࣌ؒܭଌ iOS ͷ࣌ؒؔ਺ͷਫ਼౓ - Qiita @yamoridon Λݩʹ Xcode 10.1, Swift 4.2, iPhone X ؀ڥԼʹͯܭଌ 1.00 us 1.01 us 1.00 us 1.00 us 0.05 us 1,000,000.00 us = 1,000 ms 1 ms
  4. λονݕग़Ϩʔτ • iPhone X ͓Αͼ iPad Pro ͕ 120 Hz

    Ͱͷ ݕग़ ʹରԠ • iPad Pro (2018) ͕ 120 Hz Ͱͷ දࣔ ʹରԠ • ͦΕҎ֎͸ 60 Hz - 60 Hz iOS Device Compatibility Reference - Apple Developer -> ݕग़·Ͱ࠷େ 8.33 - 16.67 ms ͷ஗Ԇ
  5. Swift ʹ͓͚Δ λΠϚʔॲཧ OperantKit ΑΓɼXcode 10.1, Swift 4.2, iPhone X,

    MacBook Pro (15-inch, 2018) 2.9 GHz Intel Core i9 ؀ڥԼʹͯܭଌɻ While loop ͸ usleep(100) ΛೖΕͨ Async dispatch ʹ࣮ͯߦɻ Delay CPU OS While loop ±0 ms 25% All (include Linux) CADisplayLink +5 ms 9% iOS, tvOS (QuartzCore) CVDisplayLink +0~16 ms 3% macOS (QuartzCore)
  6. ͜Ε·Ͱ (γϯάϧεϨου) 1000 ms + 1 ms 1000 ms +

    1 ms 1000 ms + 1 ms 3000 ms + 3 ms ஗Ԇ͸͢Δ΋ͷͷɼ Ұఆͷ஗Ԇͱ1000 ms ͕ධՁ͞Ε͍ͯͨ
  7. ஌֮͠ͳ͍ • ʮίʔϥΛҿΊʯʮϙοϓίʔϯΛ৯΂Ζʯͱ͍͏จࣈྻΛ ແҙࣝԼ (୹࣌ؒʹ܁Γฦ͠) Ͱఄࣔ • Smarandescu & Shimp

    (2015) ͷݚڀͰ͸ɼ23 ms x 13 ճͷ ܹࢗఄ͕ࣔ௚ޙͷ঎඼બ୒ʹӨڹΛٴ΅͢͜ͱΛࣔͨ͠ɻ
  8. ஌֮͠ͳ͍ • ʮίʔϥΛҿΊʯʮϙοϓίʔϯΛ৯΂Ζʯͱ͍͏จࣈྻΛ ແҙࣝԼ (୹࣌ؒʹ܁Γฦ͠) Ͱఄࣔ -> αϒϦϛφϧޮՌ • Smarandescu

    & Shimp (2015) ͷݚڀͰ͸ɼ23 ms x 13 ճͷ ܹࢗఄ͕ࣔ௚ޙͷ঎඼બ୒ʹӨڹΛٴ΅͢͜ͱΛࣔͨ͠ɻ -> ͜ͷ࣌ɼ࣮ݧࢀՃऀͷશһ͕஌֮͠ͳ͔ͬͨ
  9. ࢀߟ • iOS ͷ࣌ؒؔ਺ͷਫ਼౓ - Qiita @yamoridon • iOS Device

    Compatibility Reference - Apple Developer • Okouchi, H. (2009). Response acquisition by humans with delayed reinforcement. Journal of the Experimental Analysis of Behavior, 91(3), 377-390. • OperantChamberApp - App Store • Smarandescu, L., & Shimp, T. A. (2015). Drink coca-cola, eat popcorn, and choose powerade: testing the limits of subliminal persuasion. Marketing Letters, 26(4), 715-726. • YutoMizutani/OperantKit - GitHub