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

Androidにおけるパフォーマンスチューニング実践

D3056a4ff4bd225d03cb44627c18dfc8?s=47 neonankiti
February 08, 2019

 Androidにおけるパフォーマンスチューニング実践

再現性が低い改善が難しいパフォーマンス問題に対処するために、パフォーマンスの前提知識をつけ、定性と定量との両輪からアプローチしていく方法論に関して話しています。

- パフォーマンス改善の発端
- アプリパフォーマンスの定義
- パフォーマンス課題
- UIの改善
- データ通信量
- バッテリー消費

D3056a4ff4bd225d03cb44627c18dfc8?s=128

neonankiti

February 08, 2019
Tweet

Transcript

  1. "OESPJEʹ͓͚Δ ύϑΥʔϚϯενϡʔχϯά࣮ફ @neonankiti

  2. גࣜձࣾFiNC Technologies — Mobile Engineer(Android/iOS/Flutter) ೆཬ༐ؾ @neonankiti #εϊϘʔ #όεέ #Ωϟϯϓ

    #௼Γ #GoldGym ࣗݾ঺հ
  3. ύϑΥʔϚϯε՝୊ͷࢦఠ CTO ΞϓϦͷಈ࡞͓΋ͳ͍ʁ͸΍ͯ͘͠΍ɻ Θ͔Γ·ͨ͠ʂʂ σʔλফඅྔ΍͹͘ͳ͍ʁ௚ͯ͠΍ɻ ΊͬͪΌి஑৯ͬͯͳ͍ʂʁʂʁʂ

  4. ͳΜ͔Θ͔ΒΜ͚Ͳɺ΍ͬͯΈΔ͔

  5. νʔϜͷ࠶ฤ੒ Before After ػೳ1 ػೳ2 ػೳ3 ػೳ1 ػೳ2 ػೳ3 ڞ

    ௨ ج ൫
  6. ڞ௨ج൫νʔϜര஀

  7. ͳͥνʔϜΛ࠶ฤ੒ͨ͠ͷ͔ʁ νʔϜମ੍͸ػೳ(υϝΠϯ)୯Ґ →ػೳ୯ҐͰ͸੹೚͕ᐆດͳ໰୊͕ੜ͡Δ

  8. ۩ମతʹى͖ͨ໰୊ ɾݪҼͷΘ͔Γਏ͍Ϋϥογϡ ɾσʔλ௨৴ྔͷ૿Ճ ɾόοςϦʔফඅͷ૿Ճ ɾͳΜ͔΋ͬ͞Γͯ͠Δ

  9. ڞ௨ج൫νʔϜͷൃ଍΁ ಛఆͷػೳʹґଘ͠ͳ͍໰୊Λվળ͠ ΞϓϦͷ඼࣭ΛߴΊΔ͜ͱ͕੹຿

  10. RailsςοΩʔͳ࿩ ϚΠΫϩαʔϏεͷཁૉٕज़ͷ࿩ Ϛωδϝϯτͷ࿩ ΞϓϦύϑΥʔϚϯεվળͷલʹ

  11. ΞϓϦύϑΥʔϚϯεͱ͸ʁ

  12. ϢʔβʔମݧʹӨڹΛ༩͑Δཁૉ ɾΫϥογϡ ɾANR ɾσʔλϩʔυ ɾUI(Ξχϝʔγϣϯ) ɾόοςϦʔফඅ ɾσʔλ௨৴ྔ ΞϓϦύϑΥʔϚϯε

  13. ϦϦʔεޙʹൃੜ͠΍͍͢ ݦࡏԽͷλΠϛϯά ϦϦʔε ςετ ʷ ύϑΥʔϚϯεѱԽ

  14. ͳͥϦϦʔεޙʹൃੜ͠΍͍͢ͷ͔ʁ ςετͰͷ࠶ݱੑ͕೉͍͠ ɾຊ൪։ൃ2"؀ڥͷࠩҟ ɾ࣌ؒత੍໿Ͱػೳςετ͕ࠔ೉

  15. ςετΑΓલͷϑϩʔͰରࡦ͢Δ ࣮૷࣌ʹՄೳͳݶΓࢭΊΔ ϦϦʔε ςετ ʷ ύϑΥʔϚϯεѱԽ ࣮૷

  16. ΤϯδχΞ͕ग़དྷΔ͜ͱ ɾલఏͱͳΔ஌ࣝΛ͚ͭΔ ɾΞϯνύλʔϯΛ౿·ͳ͍࣮૷ ΞϓϦύϑΥʔϚϯεʹؔͯ͠

  17. ຊ೔ͷτϐοΫ

  18. ຊ೔࿩߲͢໨ ɾ6*ͷվળ ɾσʔλ௨৴ྔ ɾόοςϦʔফඅ ࠶ݱੑ͕೉͍߲͠໨

  19. RailsςοΩʔͳ࿩ ϚΠΫϩαʔϏεͷཁૉٕज़ͷ࿩ Ϛωδϝϯτͷ࿩ ΞϓϦύϑΥʔϚϯενϡʔχϯά࣮ફ

  20. ύϑΥʔϚϯενϡʔχϯά࣮ફ 6*ͷվળ σʔλ௨৴ྔ όοςϦʔফඅ

  21. ɾ6*ͷΧΫπΩ UIͷ໰୊ ɾ$16 (16ʹෛ୲Λ༩͑Δॲཧ

  22. ɾ6*ͷΧΫπΩ UIͷ໰୊ ɾ$16 (16ʹෛ୲Λ༩͑Δॲཧ

  23. ͳͥ6*͸ΧΫπΫͷ͔ʁ

  24. 'SBNF3BUF͕௿͍

  25. ɾFPS = Frame Per Secondsɻ ɾਓؒ͸ɺ60FPS͕࠷దͱײ͡Δ Frame Rateͱ͸ ɾ60FPS ≒

    16ms/frame ≒1ඵؒʹॲཧ͞ΕΔϑϨʔϜ਺(੩ࢭը໘)
  26. '14ͷ࣮ݱ

  27. ΞϓϦͷىಈ = Linuxϓϩηεͷىಈ શͯͷλεΫ͸ϝΠϯεϨου(UIεϨου)Ͱ࣮ߦ UI Drawing LameWork App Events UI

    Drawing UI Drawing Main Thread(UI Thread) PROCESS AndroidΞϓϦͷ࣮ߦϓϩηε ࢀߟ IUUQTXXXZPVUVCFDPNXBUDI W)92IVRG576MJTU1-R@V8#8R:U7*S';8S#;D#@XG98
  28. NTGSBNFΛӽ͑ͯ͠·͏ →Frame͕Drop͞ΕΔ 16ms UI Drawing LameWork App Events UI Drawing

    UI Drawing Main Thread(UI Thread) PROCESS 16ms 16ms Drop Over 16ms 60FPSͷࣦഊ
  29. ɾλεΫΛNTGSBNFʹ཈͑Δ 60FPSͷ࣮ݱํ๏ ɾλεΫΛ෼ࢄ͢Δ

  30. ɾωοτϫʔΫॲཧ 16ms/frameΛΦʔόʔ͠΍͍͢λεΫ ɾ*0ॲཧ ˠϝΠϯεϨουͱผεϨουͰ࣮ߦ

  31. 1. εϨου(ҎޙϫʔΧʔεϨου)ͷੜ੒ 2. ϫʔΧʔεϨου্ͰλεΫ࣮ߦ 3. ݁ՌΛϝΠϯεϨου΁  Worker Thread Main

    Thread(UI Thread) Update some UI Prep some work Do some long work ϚϧνεϨοσΟϯά  
  32. ɾϝϞϦ؅ཧϦʔΫ ϚϧνεϨοσΟϯάͷҰൠతͳίετ ɾεϨουੜ੒ͷΦʔόʔϔου

  33. εϨουΛ͍ͭੜ੒͠ɺഁغ͢Δ͔͸ඞܾͣΊΔ ɾView͔Βͷࢀর(Activity) -> LeakCanaryͷར༻ ϝϞϦ؅ཧ/ϦʔΫରԠ ɾMemory Profilerͷར༻

  34. Memory Profiler 1. ώʔϓɺϝϞϦྔͷλΠϜϥΠϯ 2. ಛఆͷλΠϛϯάͰͷΞϩέʔτ͞ΕͨΦϒδΣΫτ 1 2 ࢀߟ IUUQTEFWFMPQFSBOESPJEDPNTUVEJPQSPpMFNFNPSZQSPpMFS

    IMKB
  35. ɾCPU Profileͷར༻ εϨουੜ੒ͷΦʔόʔϔουରԠ ɾεϨουੜ੒͸Φʔόʔϔουίετ͕ߴ͍ ɾεϨουࣗମΛݮΒ͢(࠷େݸ਺͸CPUʹґଘ) ɾ࠶ར༻(RxJava͸ThreadPoolΛར༻) ࢀߟ IUUQTEFWFMPQFSBOESPJEDPNTUVEJPQSPpMFDQVQSPpMFS IMKB

  36. ɾ6*ͷΧΫπΩ UIͷ໰୊ ɾ$16 (16ʹෛ୲Λ༩͑Δॲཧ

  37. ϨϯμϦϯά

  38. ɾը໘ͷσʔλ͸πϦʔߏ଄ AndroidϨϯμϦϯάͷಛ௃ ɾιϑτ΢ΣΞඳըͱϋʔυ΢ΣΞΞΫηϥϨʔγϣϯ Ҏޙ)8"

  39. ɾτϥόʔαϧͳϓϩηεͷͨΊίετ͕ߴ͍ ϨϯμϦϯάͷίετ ɾ7JFXͷݺͼग़͠ ɾ਌͕ࢠΛଌఆ NFBTVSF 3PPU 7JFX 7JFX 7JFX 7JFX

    7JFX 7JFX 7JFX ɾ࠶ؼత ɾSPPUͷαΠζ͕ܾఆ ɾը໘্ͷҐஔΛܾఆ MBZPVU ɾ༿ϊʔυͷҐஔ͕ܾఆ
  40. ιϑτ΢ΣΞඳըͱHWA ɾ$16PS(16 ඳըํ๏ ιϑτ΢ΣΞඳը HWA Invalidate Canvas ผϨΠϠʔ શͯͷϊʔυʹӨڹ dirtyͷΈߋ৽

  41. Πϝʔδ $BOWBT ιϑτ΢ΣΞඳը HWA →શߋ৽ →dirtyͷΈ $BOWBT ϋʔυ΢ΣΞ ϨΠϠʔ dirty

  42. ɾਂ͍View֊૚ ɾιϑτ΢ΣΞඳըʹ͓͚ΔonDraw() ɾOverdrawingʹΑΔGPU࣌ؒͷফඅ ࣮૷্ͷ໰୊

  43. Ұ୴πʔϧΛ࢖ͬͯΈΔ

  44. ɾ։ൃऀΦϓγϣϯ ɹɾGPUϨϯμϦϯάͷϓϩϑΝΠϧ࡞੒ ɹɾGPUΦʔόʔυϩʔΛσόοά ɹɾGPUදࣔͷߋ৽Λදࣔ ϨϯμϦϯάͷσʔλղੳπʔϧ ɾLayoutInspector

  45. ɾLayoutͷώΤϥϧΩʔΛRuntimeͰղੳ͢ΔͨΊͷπʔ ϧɻxmlɺ·ͨ͸ಈతੜ੒ͨ͠ViewͳͲͷ֊૚ߏ଄͕Θ͔Β ͳ͍ࡍʹར༻͢Δɻ ɾTools -> LayoutInspector͔Β࣮ߦͰ͖Δ ɾproject_root/capturesʹRuntimeͷεφοϓγϣοτ͕อଘ͞ΕΔ LayoutInspector

  46. όʔδϣϯ؅ཧ(6*࣮૷ߏ଄ϓϩύςΟ Captureͷ੾Γସ͑ Viewߏ଄ ※) staging؀ڥͷͨΊdebug tool view͕දࣔ͞Ε͍ͯΔ ViewϓϩύςΟ αϯϓϧ

  47. ɾGPUϨϯμϦϯάͷϓϩϑΝΠϧ࡞੒ ɾGPUϨϯμϦϯάͷϓϩηεຖͷίετ ɾGPUΦʔόʔυϩʔΛσόοά ɾGPUϨϯμϦϯάͷOverdraw ɾGPUදࣔͷߋ৽Λදࣔ ɾGPUϨϯμϦϯάߋ৽৔ॴͷಛఆ ։ൃऀΦϓγϣϯ

  48. ։ൃऀΦϓγϣϯ GPUϓϩϑΝΠϧ GPUΦʔόʔυϩʔ - ࢵɺԫ྘ͷΤϦΞ GPUදࣔͷߋ৽ - ੺͍ਖ਼ํܗ 16msϥΠϯ 1frame

    αϯϓϧ
  49. 'J/$ΞϓϦʹࢼͯ͠ΈΔ

  50. 'J/$ΞϓϦͷར༻ස౓͕ߴ͍ը໘Ͱଌఆ ɾ੺͍৭͸Overdrawճ਺͕4ճΛ௒͑Δ΋ͷɻ ɾఆظ࣮ߦΞχϝʔγϣϯ͕૸Δ౓ʹɺGPU Profilerͷ੺ ͍όʔ͕௓Ͷ্͕Δ ɾఆظ࣮ߦΞχϝʔγϣϯΛࢭΊͯ΋ɺͳ͔ͥ਺ඵຖʹը ໘ͷ΢Οϯυ΢͕఺໓͠ɺΞοϓσʔτ͕૸ͬͯ͠·͏ɻ ɾGPU Profilerͷ੨͍όʔ͕େ͖͍ɻ ϨϯμϦϯάύϑΥʔϚϯεଌఆ

  51. ύϑΥʔϚϯεͷج४Λઃஔ͢Δ ج४Λઃఆ͢Δ ɾແବͳվળΛ͠ͳ͍ͨΊ ɾఆྔత͕೉͚͠Ε͹ɺج४Λ࡞Δ ɾߴ඼࣭ΞϓϦ ɾಉػೳΞϓϦ

  52. *OTUBHSBNͱͷൺֱ ՄೳͳݶΓಉ৚݅ ɾ੺͍όʔ͸ಉ͡ఔ౓ ɾ੨͍όʔ͕શମతʹߴ͍ɻ ɾશମతʹOverdraw͕গͳ͍ɻ ɹɾView֊૚͕গͳ͍ ɹɾແବͳΞϧϑΝ͕ͳ͍ ɹɾద੾ͳΫϦοϐϯάॲཧ ߴ඼࣭ΞϓϦͱͷൺֱ

  53. ɾOverdraw RecyclerViewͷitemViewͷ༨෼ͳView֊૚ ɾGPU Profiler ɾ੨͍όʔ͕େ͖͍ = onDraw()ͷDisplayListੜ੒ͷίετɻ onDraw()ͷස౓ɺoff-screenͷϨϯμϦϯάɺonDraw()ͷॲཧ͕ॏ͍ ɾGPUඳըͷߋ৽ ɾఆظ࣮ߦΞχϝʔγϣϯͷίετ

    ɹɾFiNCͪΌΜ(ΞΠίϯ) ۩ମతͳ໰୊఺
  54. ɾෆཁͳbackgroundͷ࡟আ Overdraw΁ͷରԠ ɾਂ͍ViewΛઙ͘͢Δ

  55. Viewίϯςφʹແବͳ֊૚͸ͳ͍͔ʁ ෆཁͳbackgroundͷ࡟আ TextView FrameLayout RecyclerView

  56. ɾxml্ͰແବͳViewίϯςφΛ࡞Βͳ͍ ਂ͍ViewΛઙ͘͢Δ ɾಈతʹ௥Ճ͢Δ৔߹Ͱ΋ɺmergeΛݕ౼ ɾConstraintLayoutΛར༻͢Δ

  57. վળ݁Ռ վળલ վળޙ

  58. ɾPO%SBX಺ͰͷϝϞϦΞϩέʔτېࢭ GPUϨϯμϦϯά΁ͷରԠ ɾPO%SBX಺ͰͷMPPQॲཧͷվળ ɾPGGTDSFFOϨϯμϦϯάͷఀࢭ

  59. PO%SBX͸ίετ͕ߴ͍ ɾෆมΦϒδΣΫτ͸ɺελοΫྖҬʹల։͢Δ Before onDraw಺ͰͷϝϞϦΞϩέʔτېࢭ ɾGC͕ߴ͍ස౓Ͱ૸ͬͯ͠·͏ After

  60. MPPQͷ$BOWBTૢ࡞͸ίετ͕ߴ͍ ɾGPUϨϯμϦϯά͸GPU΁ͷΦϒδΣΫτΛੜ੒͢Δ onDraw಺Ͱͷloopॲཧͷվળ ɾCanvas#drawLineͰloopͰ͸ͳ͘ɺCanvas#drawLinesΛ࢖͏

  61. PGGεΫϦʔϯ࣌ͷॲཧΛࢭΊΔ off-screenͷϨϯμϦϯάͷېࢭ ɾBVUPTMJEF͕ద༻ ɾλϒ ΧελϜ7JFX1BHFS Ҡಈ࣌ʹࢭΊΔ ɾWJTJCMF6TFS)JOU

  62. ఆظ࣮ߦΞχϝʔγϣϯͷ࣮ߦ GPUඳըͷߋ৽ ˠΧελϜϏϡʔͷ)8"Λ༗ޮʹ

  63. ɾ6*ͷجૅΛֶͼɺΞϯνύλʔϯΛ౿·ͳ͍ UIվળͷ·ͱΊ ɾ5PPMΛద੾ʹ࢖͍ɺύϑΥʔϚϯεΛվળ

  64. 6*ͷվળ σʔλ௨৴ྔ όοςϦʔফඅ ύϑΥʔϚϯενϡʔχϯά࣮ફ

  65. Ωϟογϡͷར༻ σʔλ௨৴ྔΛ࡟ݮ͢ΔͨΊʹ ωοτϫʔΫ Packet Packet Packet ը૾σʔλͷ࡟ݮ ม׵ γϦΞϥΠθʔγϣϯ

  66. Ωϟογϡͷར༻

  67. ϝϞϦ Ωϟογϡͱ͸ʁ σʔλͷϩʔυΛߴ଎Խ͢ΔͨΊͷ࢓૊Έ σΟεΫ

  68. Ϣʔεέʔεʹ߹Θͤͯ࢖͏ σʔλอ࣋ظؒ ϝϞϦΩϟογϡ σΟεΫΩϟογϡ ࣮ߦεϨου ΞϓϦϓϩηε Πϯετʔϧத ͲͷεϨουͰ΋ྑ͍ ϫʔΧʔεϨου อଘྖҬ

    গͳ͍ ଟ͍ ϝϞϦ vs σΟεΫΩϟογϡ
  69. ɾϝϞϦΩϟογϡ༻ͷAndroidఏڙΫϥε →࢖༻ՄೳϝϞϦ্ݶͷνΣοΫ →্ه͔ΒLruCacheͷར༻ՄೳϝϞϦྔΛׂΓ౰ͯ ࢀߟ) https://developer.android.com/topic/performance/graphics/cache-bitmap ɾ࢖༻ස౓͕௿͍σʔλΛ࡟আ͍ͯ͘͠ LruCacheΛ༻͍ͨϝϞϦΩϟογϡ

  70. ɾσΟεΫ: ετϨʔδͷ2%ΛׂΓ౰ͯ (5MBʙ50MBͷൣғ಺) ࢀߟ) https://github.com/square/picasso/blob/master/picasso/src/main/java/com/squareup/picasso3/Utils.java#L163-L182 ɾsquareࣾͷը૾ϩʔυ&ΩϟογϡͷϥΠϒϥϦ ࢀߟ) https://github.com/JakeWharton/picasso2-okhttp3-downloader/blob/master/src/main/java/com/jakewharton/picasso/OkHttp3Downloader.java ɾΧελϜΩϟογϡ(Okhttp3) ɾϝϞϦ:

    ώʔϓྖҬͷ15%ΛׂΓ౰ͯ ࢀߟ) https://github.com/square/picasso/blob/master/picasso/src/main/java/com/squareup/picasso3/Utils.java#L184-L190 PicassoΛ༻͍ͨϝϞϦ/σΟεΫΩϟογϡ
  71. Ωϟογϡ͸ೋछྨ͋ΓɺϝϞϦ͸شൃੑɺσΟε Ϋ͸ෆشൃੑ Ωϟογϡ͸σʔλ΁ͷΞΫηεΛߴ଎Խ͢Δ Ωϟογϡར༻ͷ·ͱΊ →σʔλϩʔυͷͨΊͷωοτϫʔΫॲཧճ਺͕ݮ গ͠ɺύϑΥʔϚϯε͕޲্͢Δɻ

  72. Ωϟογϡͷར༻ σʔλ௨৴ྔΛ࡟ݮ͢ΔͨΊʹ ωοτϫʔΫ Packet Packet Packet ը૾σʔλͷ࡟ݮ ม׵ γϦΞϥΠθʔγϣϯ

  73. γϦΞϥΠθʔγϣϯ

  74. ྫ) ɾAPI௨৴ͰͷKotlin 㲗 JSON ɾΩϟογϡ࣌ͷϑΝΠϧॻ͖ࠐΈ ௚ྻԽͷ͜ͱɻಛఆͷ؀ڥʹґଘͨ͠ΦϒδΣΫτ ΛόΠτྻʹม׵͢Δ͜ͱ γϦΞϥΠθʔγϣϯͱ͸ʁ ม׵

  75. γϦΞϥΠθʔγϣϯͷύϑΥʔϚϯε ϝϦοτ ςΩετ(JSON, XML) όΠφϦʔܗࣜ Մಡੑ͕ߴ͍ σϝϦοτ ແବͳσʔλ͕ଟ͍ σʔλྔ͕গͳ͍ Մಡੑ͕௿͍

    ςΩετ vs όΠφϦʔ
  76. +40/ͰͷςΩετܗࣜ ɾςΩετϕʔεͷܗࣜ͸৑௕Ͱσʔλྔ͕ଟ͘ͳΔ { “id”: 0, “name”: “bison”, “image”: “https://bisonworks/bisons/1/image” }

    ۭന Ϧλʔϯ ࢀর JSON
  77. ɾprotoϑΝΠϧΛఆٛ →ίϯύΠϧ →ݴޠ͝ͱͷߏ଄ମͷੜ੒ ɾόΠφϦܗࣜͰγϦΞϥΠζ͞ΕΔɻ ɾෳ਺ݴޠؒͰͷҰ؏ੑΛอͯΔ ɾprotoϑΝΠϧ͸Մಡੑ΋ߴ͍ message Animal { required

    string name = 1; required int32 id = 2; optional string image =3; } Protocol Buffers
  78. ɾςΩετܗࣜ(JSON, XML)͸Մಡੑ͸ߴ͍͕ɺσʔλྔ͸ଟ͍ ɾόΠφϦʔܗࣜ͸Մಡੑ͸௿͍͕ɺσʔλྔ͸গͳ͍ɻ ɾProtocol Buffers͸DSLͷΑ͏ͳ΋ͷͰɺՄಡੑ͕ߴ͘ɺ ͔ͭૹड৴࣌ͷγϦΞϥΠζ͞Εͨσʔλྔ΋গͳ͍ γϦΞϥΠθʔγϣϯͷ·ͱΊ →Protocol BufferͰՄಡੑߴ͘ɺσʔλྔ͕গͳ͍γϦ ΞϥΠζΛߦ͏

  79. Ωϟογϡͷར༻ σʔλ௨৴ྔΛ࡟ݮ͢ΔͨΊʹ ωοτϫʔΫ Packet Packet Packet ը૾σʔλͷ࡟ݮ ม׵ γϦΞϥΠθʔγϣϯ

  80. ը૾σʔλͷ࡟ݮ

  81. ը૾ϑΥʔϚοτʹؔͯ͠ ը૾ͷϑΥʔϚοτʹ஫ҙ͢Δ ɾσʔλྔ͕ஶ͘͠มΘΔ ɾը૾ͷΫΦϦςΟ͕มΘΔ

  82. ը૾ϑΥʔϚοτνʔτγʔτ ࢀߟ IUUQTEFWFMPQFSBOESPJEDPNUPQJDQFSGPSNBODFOFUXPSLYGFS

  83. WebPͷύϑΥʔϚϯε Մٯѹॖͷ৔߹ɺPNGΑΓ26%খ͍͞ ෆՄٯѹॖͷ৔߹ɺJPEGΑΓ25-34%খ͍͞ ࢀߟ IUUQTEFWFMPQFSTHPPHMFDPNTQFFEXFCQ

  84. WebPҎ֎ͷ৔߹ PNG͔JPEG͔

  85. PNGͱJPEG PNG JPEG ɾಁաʹରԠ ɾՄٯѹॖ ɾෆՄٯѹॖ

  86. Ϣʔεέʔε PNG JPEG ɾγϯϓϧͳը૾ ɾෳࡶͳը૾ Α͘ݴΘΕΔը૾ͷ࢖͍෼͚

  87. γϯϓϧͳը૾ͷఆٛͱ͸

  88. γϯϓϧͳը૾ PNG JPEG ɾෳࡶͳۂઢ͕ଘࡏ͠ͳ͍ܗ ɾ৭ͷόϦΤʔγϣϯ͕গͳ͍ ɾෳ਺ͷ৭ͷόϦΤʔγϣϯ ɾෳࡶͳۂઢ

  89. ͳ͔ͥʁ

  90. PNGѹॖͷΞϧΰϦζϜ(Indexed Format) RGBΛࢀর͢Δܗʹมߋ͢Δ ɾը૾͸ϐΫηϧ͝ͱʹRGB৘ใΛ࣋ͭ ɾ8bit(256֊ௐ) * 3 = 24bit =

    2^24 ≒ 1600ສ৭ ɾϐΫηϧ͕࣋ͭ৘ใ͸IndexͷΈ ɾΧϥʔύϨοτΛ࣋ͭ(্ݶΛઃ͚Δ)
  91. ୯ҐϐΫηϧͷ৘ใྔ͕ܹݮ͢Δ ύϨοτ਺͸2,4,16,256͕ࢦఆͰ͖Δ ɾ1byteͰදݱͰ͖Δ 24bit = 3bytes 1byte

  92. JPEGͷΞϧΰϦζϜ 8ϐΫηϧ͝ͱͷϒϩοΫʹ෼͚ͯॲཧ ϒϩοΫ಺Ͱ৘ใΛϑΟϧλϦϯά͢Δ

  93. ௚ઢతͳڥքʹऑ͍ ڥք͕ΑΓ௚ઢͩͱը࣭͕ѱ͘ͳΔ 8pixel

  94. ໨ࢹνΣοΫ ਓؒͷ໨͸͍͍Ճݮ ໨ࢹνΣοΫͰσʔλྔͷ࡟ݮΛʂ

  95. ը૾σʔλ࡟ݮͷ·ͱΊ WebPରԠ͍ͯ͠Ε͹WebPͷҰ୒ JPEGɺPNGͷσʔλྔΛཧղ͢Δɻ ͦͷ্Ͱ࣮ࡍͷ໨Ͱ֬ೝͯ͠ѹॖ͢Δɻ

  96. 6*ͷվળ σʔλ௨৴ྔ όοςϦʔফඅ ύϑΥʔϚϯενϡʔχϯά࣮ફ

  97. ɾϓϩηοα(ϋʔυ)Ͱిྲྀ͕ྲྀΕΔ ɾOS(ιϑτ)͕CPUͷϞʔυมߋΛߦ͏ → CPUϞʔυΛ௿͘อͭ όοςϦʔফඅΛ࡟ݮ͢ΔͨΊʹ

  98. $16͸ిྗΛޮ཰తʹ࢖͓͏ͱ͢Δ CPUʹ͸Ϟʔυ͕͋Δ

  99. ࣍ͷॲཧʹඋ͑Δ,FFQ"XBLFͷίετ ϞόΠϧ௨৴࣌ͷফඅిྗ

  100. ϞόΠϧ௨৴Λࡉ੾Εʹͨ͘͠ͳ͍

  101. όονॲཧͱ͸ʁ ෼ࢄͨ͠λεΫΛಉ࣌ʹ࣮ߦ͢Δ͜ͱɻΦʔόʔϔουΛݮগͤ͞Δɻ Task Before After Executed Task Executed Task Executed

    Task Task Task Executed 1 1 1 1 ϞόΠϧ௨৴࣌ͷফඅిྗ
  102. αʔόʔͱͷσʔλͷಉظੑ͕ݫີͰͳ͍΋ͷ ࠷ѱɺσʔλ͕ࣦΘΕͯ΋໰୊͕ͳ͍΋ͷ ෼ੳϩάσʔλ ఆظతͳσʔλͷಉظ ϞόΠϧʹ͓͚Δόονॲཧ

  103. ɾJobSchedulerͱAlertManagerΛOSόʔδϣϯͰ࢖͍෼͚ ɾෳ਺λεΫͷνΣΠϯ ɾδϣϒʹ੍ݶΛ͚ͭΒΕΔ ɾόοςϦʔফඅ/ωοτϫʔΫঢ়ଶ/ॆిঢ়ଶ/CPUͷঢ়ଶ/ετϨʔδͷۭ͖ ɾ஗ԆͰ͖Δ(Deferrable)ఆظత/ϫϯλΠϜͳδϣϒʹ࢖͏ WorkManager ɾόοΫΦϑ(ࢦ਺ؔ਺తස౓)αϙʔτ

  104. ϘτϧωοΫΛ୳Γ͍ͨ

  105. #BUUFSZ)JTUPSJBO ୺຤ͷόοςϦʔফඅྔΛՄࢹԽग़དྷΔπʔϧ 1. OverViewͷάϥϑ ɾ߲໨ΛϐοΫͨ͠ΧελϜάϥϑ΋Ͱ͖Δ 2. App Selection ɾΞϓϦ/߲໨ͰϑΟϧλՄೳ 3.

    Tables ɾΞϓϦؒൺֱ/ώετϦʔ(ྦྷੵσʔλ)/ΞϓϦελοπ 4. ݁Ռ ɾϑΟϧλ݁ՌΛදࣔ͢Δ σʔλղੳπʔϧ
  106. ɾ୺຤ͷి஑ফඅྔΛՄࢹԽग़དྷΔπʔϧ ɾDocker্Ͱಈ͘(Α͏ʹͳͬͯΔʂ) 1. OverViewͷάϥϑ 2. App Selection 3. Tables 4.

    ݁Ռ Battery Historianͷશମతͳߏ੒
  107. ɾެࣜ: https://github.com/google/battery-historian EPDLFSSVOQQPSUHDSJPBOESPJECBUUFSZIJTUPSJBOTUBCMFQPSU ɾ<port>͸ԿͰ΋Α͍ɻ9999ͱ͔ʹ͓ͯ͘͠ IUUQMPDBMIPTUQPSU ɾAndroid୺຤಺ʹbugreportsͷdir͕͋Δ adb bugreport bugreport.zip ※)

    ެࣜͷͰΤϥʔ͕ग़Δਓ͸ී௨ʹabdͰϑΝΠϧసૹ͍ͯͩ͘͠͞ɻ ؀ڥߏங
  108. Battery Level͸1ࠁΈͳͷͰɺ୹͍෦෼͕ফඅిྗ͕ߴ͍෦෼ όοςϦʔͷղੳํ๏

  109. CPUͷϞʔυ ϞόΠϧ௨৴͸ίετ͕ߴ͍ όοςϦʔͷղੳํ๏

  110. ܧଓతଌఆ͕೉͍͠

  111. ܦݧ্ɺٙͬͯΈΔͱྑͦ͞͏ͳ͜ͱ όοΫάϥ΢ϯυͰఆظతͳॲཧΛ࣮ߦ͍ͯ͠Δ ը໘্Ͱଟ͘ͷωοτϫʔΫॲཧΛߦ͍ͬͯΔλεΫ ఆੑతʹ΋Ξϓϩʔν͢Δ ɾස౓ɺॏ͍ॲཧ ɾෆద੾ͳϥΠϑαΠΫϧ(onResumeͳͲ)Ͱͷίʔϧ

  112. CPUͷϞʔυ(awake, sleep)ΛSleep΁ ϞόΠϧ௨৴͸஗ԆΛݕ౼͢Δ ఆྔͱఆੑతͳ྆໘͔ΒΞϓϩʔν͢Δ όοςϦʔফඅͷ࠷దԽ·ͱΊ

  113. RailsςοΩʔͳ࿩ ϚΠΫϩαʔϏεͷཁૉٕज़ͷ࿩ Ϛωδϝϯτͷ࿩ શମతͳ·ͱΊ

  114. શମతͳ·ͱΊ ࠶ݱੑ͕௿͍ύϑΥʔϚϯε໰୊ʹରॲ͢Δ ύϑΥʔϚϯεͷલఏ஌ࣝΛ͚ͭɺఆੑͱఆྔͱͷ ྆ྠ͔ΒΞϓϩʔν͍ͯ͘͠