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

Profileable buildでより正確なパフォーマンスを掴む

Profileable buildでより正確なパフォーマンスを掴む

2023/2/17に開催されたshibuya.apk #40で登壇した、「Profileable buildでより正確なパフォーマンスを掴む」のスライドです

Yoshihiro WADA

February 17, 2023
Tweet

More Decks by Yoshihiro WADA

Other Decks in Programming

Transcript

  1. { “id”: “@e10dokup”, “name”: “Yoshihiro Wada”, “affiliation”: “CyberAgent Inc, /

    Ameba”, “interested”: [ “camera”, “gadget”, “driving”, “motorsports” ] }
  2. w ύϑΥʔϚϯεଌఆ w ʮύϑΥʔϚϯε͕ѱ͍ΞϓϦʯͱ͸ʁ w ύϑΥʔϚϯεΛଌΔํ๏ w 1SP fi MFBCMFCVJMEͱ͸ʁ

    w ҎԼͷ಺༰ʹ͸৮Ε·ͤΜ w ͲͷΑ͏ʹύϑΥʔϚϯεΛվળ͢Δ͔ ࠓճͷ࿩୊ 3
  3. w ։ൃऀ޲͚Φϓγϣϯ͔ΒϓϩϑΝΠϥΛىಈͰ͖Δ w όʔδϣϯʹΑ໊ͬͯલ͕ҧ͏ w ʮ)86*ϨϯμϦϯάͷϓϩϑΝΠϧ࡞੒ʯ w ʮ(16ϨϯμϦϯάͷϓϩϑΝΠϧ࡞੒ʯ w ༗ޮʹ͢Δͱɺը໘্ʹ֤ϑϨʔϜͷඳըʹ͔͔Δ࣌ؒ

    
 ͕๮άϥϑͰදࣔ͞ΕΔ "OESPJEͷ࣮ػ্ͰඳըͷύϑΥʔϚϯεΛ֬ೝ͢Δ 9 ref: https://developer.android.com/topic/performance/rendering/inspect-gpu-rendering
  4. w ʮͦΓΌ͋ɺ͍ͬͺ͍ϝϞϦ࢖ͬͯΔͱ͍͏͜ͱͰ͸ʁʯ w ·͊ɺͦͷͱ͓Γɻ w "OESPJEʹ͸ΨϕʔδίϨΫγϣϯ΍ϝϞϦڞ༗ͱ͍ͬͨ؅ཧػೳ͕උ Θͬͯ͸͍Δ͕ɺݶք͸͋Δ w ϝϞϦϦʔΫʹΑͬͯΨϕʔδίϨΫλʔ͕ϝϞϦΛ։์Ͱ͖ͳ͍ w

    ؅ཧͷ଎౓Λ௒͑Δ੎͍ͰΞϓϦ͕ϝϞϦΛཁٻ͢Δ w Ϣʔβ͸ʮ࢖͍ͬͯΔͱͲΜͲΜ஗͘ͳΔͷͰλεΫΩϧΛ͢Δʯͱ͍ ͏ೝࣝΛ͢Δ ϝϞϦͷ࢖༻ྔ͕ߴ͍ͬͯʁ 13
  5. w %FCVHCVJMEͰΈ͍ͯΔʁ w android:debuggable=“true” w "OESPJE1SP fi MFS͕ඞཁ͔ͩΒ w σόοάϥΠϒϥϦ͕debugImplementationͰґଘ͍ͯ͠Δ͔Β

    w %FCVHCVJME͸3FMFBTFCVJMEͱ͸ҧ͍ɺύϑΥʔϚϯε໘Ͱ͸ෆར w σόοά৘ใΛఏڙ͢ΔͨΊʹɺίϯύΠϥͷ࠷దԽΛࢭΊΔͳͲ ύϑΥʔϚϯεଌఆͷ؀ڥʹ͍ͭͯ 16
  6. w "OESPJEҎ߱Ͱಋೖ͞Εͨ"OESPJE.BOJGFTUʹ͚ͭΔ༻ͷλά •<profileable android:shell=["true" | "false"] /> w %FCVHCVJME͕͍࣋ͬͯͨΦʔόʔϔουΛճආͭͭ͠ɺϓϩϑΝΠϦ ϯάπʔϧΛ༗ޮʹ͢Δ

    w %FCVHCVJMEͱൺֱͨ͠ͱ͖ʹɺύϑΥʔϚϯε΁ͷӨڹ͕খ͍͞ w ΑΓਖ਼֬ͳύϑΥʔϚϯε৘ใΛಘΔ͜ͱ͕Ͱ͖Δ 1SP fi MFBCMFCVJME͕௥Ճ͞Ε·ͨ͠ 19 ref: https://android-developers.googleblog.com/2022/10/accurately-measure-android-app-performance-with-profileable-builds.html
  7. w ݁࿦͔Βݴ͏ͱେৎ෉ w ೉ಡԽΛεΩοϓ͢Δ΋ͷͰ͸ͳ͍ͷͰγϯϘϧ͸ܽམ͢Δ w (PPHMFͷTUQBSUZBQQT͸طʹετΞʹ͋Δ΋ͷ͕1SP fi MFBCMFCVJME w ํ਑తʹ͸ηΩϡϦςΟ͕༏ઌ͞ΕΔͷͰɺ੍ݶ͕͸͍Δ

    w $161SP fi MFS͸ίʔϧελοΫαϯϓϦϯάɺγεςϜτϨʔεͳ ͲɺλΠϛϯάͷଌఆʹॏཁͳϓϩϑΝΠϧ͔͠αϙʔτ͠ͳ͍ w .FNPSZ1SP fi MFS΋ωΠςΟϒϝϞϦͷϓϩϑΝΠϧͷΈ w &OFSHZ1SP fi MFS΍&WFOU5JNFMJOF͸ͦ΋ͦ΋࢖͑ͳ͍ 1SP fi MFBCMFCVJMEɺຊ൪ΞϓϦͰ΍Δͷ͸େৎ෉ͳͷʁ 22
  8. w ཁɿ"OESPJE4UVEJP'MBNJOHP "(1 w 1SP fi MFbBQQOBNF`XJUIMPXPWFSIFBEͱ͍͏Φϓγϣϯ͕௥Ճ͞ Εͨ w ࣗಈతʹ1SP

    fi MFBCMFCVJMEΛߦ͍ɺϓϩϑΝΠϥ্Ͱ΋໌ࣔతʹ ʮ1SP fi MFBCMFCVJMEͰݟ͍ͯΔʯ͜ͱ͕දࣔ͞ΕΔ w ͲͷϏϧυλΠϓ΋1SP fi MFBCMFʹͰ͖Δ͕ɺύϑΥʔϚϯεଌఆ໨త Ͱ͋Ε͹SFMFBTFCVJMEͳͲɺVOEFCVHHBCMFͳλΠϓΛࢦఆ͢΂͖ "OESPJE4UVEJPͰ1SP fi MFBCMF#VJMEΛࣗಈతʹߦ͏ 26
  9. w "OESPJE.BOJGFTUʹQSP fi MFBCMFλάΛ͚ͭΔ w <profileable android:shell="true" /> w #VJME'MBWPSΛVOEFCVHHBCMFͳCVJMEUZQFʹࢦఆ͢Δ

    w ॺ໊ͨ͠ΞϓϦΛ࡞Δ w σόοάॺ໊Ͱ΋ɺ1SP fi MFBCMFCVJMEઐ༻ͷॺ໊Ͱ΋0, w "OESPJEҎ߱ͷσόΠεͰΞϓϦΛ࣮ߦ͢Δͱɺ֤1SP fi MFS͔Β 1SP fi MFBCMFCVJMEͰಈ͍͍ͯΔϓϩηεΛࢦఆ͢Δ͜ͱ͕Ͱ͖Δ ࣗ෼Ͱ1SP fi MFBCMFCVJMEΛߦ͏ 27
  10. w ύϑΥʔϚϯεͷଌఆ͸ͪΌΜͱ΍͍ͬͯ·͔͢ʁ w ໨ࢹͰ໌֬ʹ஗͍Ͱ͸ͳ͘ɺ1SP fi MFS౳ͰʮίίͷύϑΥʔϚϯε͕ ѱ͍ʯΛ໌֬ʹσʔλͱͯ͠ಘΔͷ͸େ੾ w 1SP fi

    MFBCMFCVJMEΛ࢖͏͜ͱͰɺΑΓਖ਼֬ͳύϑΥʔϚϯε৘ใΛऔಘ ͢Δ͜ͱ͕Ͱ͖Δ w ̋̋ͳλΠϛϯάͰύϑΥʔϚϯε͕མ͍ͪͯΔʂͱ͍͏ͷ͕Θ͔ͬ ͨΒɺ%FCVHCVJMEͳΓͰͳΜͰམ͍ͪͯΔͷ͔ΛΑΓৄࡉʹ٧Ίͯ ͍͘ͷ͕ྑͦ͞͏ ·ͱΊ 28