معیار
| آخرین بهروزرسانی | انتشار پایدار | کاندیدای انتشار | انتشار بتا | انتشار آلفا |
|---|---|---|---|---|
| ۱۷ دسامبر ۲۰۲۵ | ۱.۴.۱ | - | - | ۱.۵.۰-آلفا۰۱ |
اعلام وابستگیها
برای افزودن وابستگی به Benchmark، باید مخزن Google Maven را به پروژه خود اضافه کنید. برای اطلاعات بیشتر، مخزن Maven گوگل را مطالعه کنید.
ماکروبنچمارک
برای استفاده از Macrobenchmark در پروژه خود، وابستگیهای زیر را به فایل build.gradle مربوط به ماژول macrobenchmark خود اضافه کنید:
شیار
dependencies { androidTestImplementation "androidx.benchmark:benchmark-macro-junit4:1.4.1" }
کاتلین
dependencies { androidTestImplementation("androidx.benchmark:benchmark-macro-junit4:1.4.1") }
میکروبنچمارک
برای استفاده از Microbenchmark در پروژه خود، وابستگیهای زیر را به فایل build.gradle ماژول microbenchmark خود اضافه کنید:
شیار
dependencies { androidTestImplementation "androidx.benchmark:benchmark-junit4:1.4.1" } android { ... defaultConfig { ... testInstrumentationRunner "androidx.benchmark.junit4.AndroidBenchmarkRunner" } }
کاتلین
dependencies { androidTestImplementation("androidx.benchmark:benchmark-junit4:1.4.1") } android { ... defaultConfig { ... testInstrumentationRunner = "androidx.benchmark.junit4.AndroidBenchmarkRunner" } }
کتابخانه Microbenchmark همچنین یک پلاگین Gradle را برای استفاده با ماژول microbenchmark ارائه می دهد. این افزونه پیشفرضهای پیکربندی ساخت را برای ماژول تنظیم میکند، نسخه خروجی معیار را برای میزبان تنظیم میکند و وظیفه ./gradlew lockClocks را ارائه میکند.
برای استفاده از این افزونه، خط زیر را در بلوک «plugins» در فایل build.gradle سطح بالای خود قرار دهید:
شیار
plugins { id 'androidx.benchmark' version '1.4.1' apply false }
کاتلین
plugins { id("androidx.benchmark") version "1.4.1" apply false }
سپس افزونه را در فایل build.gradle ماژول بنچمارک خود اعمال کنید
شیار
plugins { id 'androidx.benchmark' }
کاتلین
plugins { id("androidx.benchmark") }
بازخورد
بازخورد شما به بهبود Jetpack کمک میکند. اگر مشکلات جدیدی کشف کردید یا ایدههایی برای بهبود این کتابخانه دارید، به ما اطلاع دهید. لطفاً قبل از ایجاد یک کتابخانه جدید، نگاهی به مشکلات موجود در این کتابخانه بیندازید. میتوانید با کلیک بر روی دکمه ستاره، رأی خود را به یک مشکل موجود اضافه کنید.
برای اطلاعات بیشتر به مستندات ردیاب مشکل مراجعه کنید.
نسخه ۱.۵
نسخه ۱.۵.۰-آلفا۰۱
۱۷ دسامبر ۲۰۲۵
androidx.benchmark:benchmark-*:1.5.0-alpha01 منتشر شد. نسخه 1.5.0-alpha01 شامل این کامیتها است.
- Macrobenchmark 1.5 از
UiAutomator2.4 برای سادهسازی تعامل با برنامهی اندازهگیریشده استفاده میکند. شیء MacrobenchmarkScope اکنون از UiAutomatorTestScope ارثبری میکند که به شما امکان میدهد از APIهای مدرنUiAutomatorمانندonElement { ... }.click()استفاده کنید. - برای اطلاعات بیشتر در مورد
UiAutomator2.4، به مستندات مراجعه کنید.
ویژگیهای جدید
- افزونه Gradle پروفایل پایه دیگر در AGP 9.0
newDsl=falseنیاز ندارد ( Iaaac7 ، b/443311090 ) - پیکربندی ردیابی را گسترش دهید تا اندازه هسته (مثلاً کوچک/بزرگ) را در ردیابیهای سیستم/کامل ثبتشده توسط معیار لحاظ کند. ( I8e397 ، b/457469959 )
تغییرات API
- (در رابط کاربری)
startActivitywait برای منتظر ماندن برای پنجره جدید تغییر کرد. ( I35da6 ، b/440021797 ) - APIهای
BlackHoleرا در androidx.benchmark پایدار کنید. ( I2b67e ، b/451749438 ) - برای راحتی کار
@JvmOverloadsبرای سازندههایPerfettoTraceRuleاضافه کنید. ( I1510a ، b/443763207 )
نسخه ۱.۴
نسخه ۱.۴.۱
۱۰ سپتامبر ۲۰۲۵
androidx.benchmark:benchmark-*:1.4.1 منتشر شد. نسخه ۱.۴.۱ شامل این کامیتها است.
رفع اشکالات
- خطای
perfettoSdkTracing=true(مثلاً هنگام ردیابی Compose در یک میکروبنچمارک) که اگر فرآیند هدف در حال اجرا بود و StartupMode مشخص نشده بود، آن را از بین میبرد، رفع شد. ( Ib2c1f )
نسخه ۱.۴.۰
۳۰ ژوئیه ۲۰۲۵
androidx.benchmark:benchmark-*:1.4.0 منتشر شد. نسخه ۱.۴.۰ شامل این کامیتها است.
تغییرات مهم از زمان ۱.۳.۰
میکروبنچمارک
- وظایف Gradle
lockClocksوunlockClocksبه جای قرار گرفتن در سطح بالا برای رعایت ایزولهسازی پروژه Gradle، به پروژههای بنچمارک منتقل شدند. -
BenchmarkRuleبازسازیشده بر روی کوروتینها ساخته میشود و از رفتارyield()بهتری پشتیبانی میکند. این امر باید خطر ANRها را در طول اجراهای بنچمارک، به ویژه اجراهای طولانی CI، به طور قابل توجهی کاهش دهد. توجه: بنچمارکهای UI باید باmeasureRepeatedOnMainThreadاجرا شوند.
ماکروبنچمارک
- راه حلی برای
CompilationMode.None()در API 34+ اضافه شد که به دلیل کامپایل ناقص برنامهها پس از اولین اجرا توسط ART، عملکرد ناپایداری داشت. - ویژگی آزمایشی - Startup Insights میتواند با ارسال
MacrobenchmarkRule(..., experimentalConfig = ExperimentalConfig(StartupInsightsConfig(isEnabled = true)))مشکلات رایج خاصی را در یک Macrobenchmark هنگام راهاندازی برجسته کند. - ArtMetric اضافه شده است که میتواند برای تشخیص کامپایل JIT و بارگذاری کلاسهای بهینهسازی نشده استفاده شود - هر دو برای اعتبارسنجی بهینهسازیهای Baseline Profile مفید هستند.
پروفایلهای پایه
-
BaselineProfileRuleاکنون پروفایلهای برنامههای چندپردازشی را جمعآوری میکند.
سایر تغییرات
- TraceProcessor به کتابخانهی خودش (
androidx.benchmark:benchmark-traceprocessor) منتقل شده است تا در موارد دیگر، بتوان از آن خارج از معیارهایMacrobenchmarkاستفاده کرد. همچنین میتوان آن را با تعریف ServerLifecycleManager خودتان، روی Desktop JVM اجرا کرد.
نسخه ۱.۴.۰-rc01
۱۸ ژوئن ۲۰۲۵
androidx.benchmark:benchmark-*:1.4.0-rc01 منتشر شد. نسخه 1.4.0-rc01 شامل این کامیتها است.
رفع اشکالات
- راه حلی برای تصاویر زمان اجرا اضافه شد که باعث میشد
CompilationMode.None()بدترین حالت عملکرد را پس از اولین تکرار اندازهگیری نکند. متأسفانه این راه حل نیاز به یک تأخیر ۵ ثانیهای دارد تا تصویر زمان اجرا را در ابتدای هر مجموعه ماکروبنچمارک ( I4a4f1 ) عمداً خراب کند.
نسخه ۱.۴.۰-بتا۰۲
۴ ژوئن ۲۰۲۵
androidx.benchmark:benchmark-*:1.4.0-beta02 منتشر شد. نسخه 1.4.0-beta02 شامل این کامیتها است.
تغییرات API
- یک
BaselineProfileConfig.Builderاضافه شده است تا فراخوانیBaselineProfileRule.collectWithResults()برای توسعهدهندگان جاوا آسانتر شود. ( I94905 )
نسخه ۱.۴.۰-بتا۰۱
۷ مه ۲۰۲۵
androidx.benchmark:benchmark-*:1.4.0-beta01 منتشر شد. نسخه 1.4.0-beta01 شامل این کامیتها است.
تغییرات API
- نوع سازنده
PerfettoTraceRuleکهPerfettoConfig( Ie53ba ) را میپذیرد، اضافه شد.
رفع اشکالات
- قالب لینک بینش راهاندازی
TraceProcessorبهروزرسانی شد تا از افزونه صحیح استفاده کند و جداکننده واضحتری داشته باشد (:کوتاهتر از%3Aاست و هر دو پشتیبانی میشوند) ( Ie18ef ) - همیشه از force-stop برای بستن فرآیندها استفاده کنید، حتی هنگام روت کردن و بستن برنامههای سیستمی. خطاهایی از این نوع را برطرف میکند:
Expected no stdout/stderr from killall ... No such process. ( Idca2c )
مشارکت خارجی
- کنترلکنندهی استثنای پروکسی برای
TraceProcessorHttpServer( I480f5 ) اضافه شد.
نسخه ۱.۴.۰-آلفا۱۱
۹ آوریل ۲۰۲۵
androidx.benchmark:benchmark-*:1.4.0-alpha11 منتشر شد. نسخه 1.4.0-alpha11 شامل این کامیتها است.
تغییرات API
- آرگومان timeout مربوط به
TraceProcessorتغییر کرد: مدت زمان برای timeoutMs long جهت قابلیت استفاده از فراخوانیکننده جاوا. ( I9fbb5 ) - سازندهی
TraceProcessorرا به عنوان داخلی علامتگذاری کنید. فراخوانیکنندگان بایدTraceProcessor.startServerیاTraceProcessor.runServerاستفاده کنند. ( Ia8c5b )
رفع اشکالات
- هنگام kill کردن برنامه با
MacrobenchmarkScope.killProcess، نتایج دستور kill را اعتبارسنجی کنید تا از خطای بیصدا و خطای timeout جلوگیری شود. ( I84555 )
بهروزرسانیهای وابستگی
- این کتابخانه اکنون سطح زبان Kotlin 2.0 را هدف قرار میدهد و به KGP 2.0.0 یا جدیدتر نیاز دارد. ( Idb6b5 )
نسخه ۱.۴.۰-آلفا۱۰
۲۶ مارس ۲۰۲۵
androidx.benchmark:benchmark-*:1.4.0-alpha10 منتشر شد. نسخه 1.4.0-alpha10 شامل این کامیتها است.
تغییرات API
- افزایش زمان پیشفرض برای بارگذاری و پرسوجوی سرور
TraceProcessorبه ۱۲۰ ثانیه (از ۶۰/۳۰ ثانیه قبلی) و قابل تنظیم بودن هر دو با یک پارامتر زمانبندی ( Ifec87 )
رفع اشکالات
- چند مشکلی که هنگام بنچمارک یا گرفتن پروفایل یک برنامه بدون
profileinstallerرخ میداد، برطرف شد وBroadcastRecieverنیز در آن گنجانده شده است. این مشکل فقط روی دستگاههای روت شده تأثیر میگذارد. ( Ied308 )
نسخه ۱.۴.۰-آلفا۰۹
۱۲ مارس ۲۰۲۵
androidx.benchmark:benchmark-*:1.4.0-alpha09 منتشر شد. نسخه 1.4.0-alpha09 شامل این کامیتها است.
تغییرات API
-
TraceProcessorو Session API با Handleهای قابل بستن، برای استفاده آسانتر با چرخههای عمر سفارشی اضافه شدند. این همچنین گامی در جهت فعالسازی آسانتر استفاده از Coroutine و Java API است. توابع افزونهTraceProcessor.runServer {}اکنون به صورت آزمایشی علامتگذاری شدهاند، زیرا احتمالاً در آینده منتقل میشوند و غیرآزمایشی میشوند. ( I358b4 )
رفع اشکالات
- رفع مشکل عدم کارکرد ضبط Benchmark و Baseline Profile با API 36 به دلیل تغییر در
pgreptoybox که اکنون برای چاپ خط فرمان کامل-aنیاز دارد. ( Idc991 ) - پیکربندی ردیابی پیشفرض را فیلتر کنید تا خطر از دست رفتن دادهها در ردیابیها در سطوح API جدیدتر کاهش یابد. ( I54e8a )
- آرگومان آزمایشی
androidx.benchmark.killExistingPerfettoRecordingsبرای ابزار دقیق اضافه شد که میتوان آن را رویfalseتنظیم کرد تا امکان ادامه ضبط ردیابی perfetto از پیش موجود فراهم شود. به طور پیشفرض، ضبط ردیابی perfetto از پیش موجود روی دستگاه برای جلوگیری از تداخل از بین میرود. ( I02a3c ) - فیلد JSON مربوط به
context.osCodenameAbbreviatedاکنون برای نسخههای سیستم عامل منتشر شده در API 35 و بالاتر،RELخواهد بود، زیرا نامهای کد غیر عددی دیگر توسط پلتفرم اصلی پشتیبانی نمیشوند. ( Ib17fd ) - رفع مشکل کرش کردن
FrameTimingMetricهنگام همگامسازی مجدد فریمها. ( I7c6f4 ، b/394610806 ) - دیگر فرض نکنید که
Choreographer#doFrameبالای فریم پشته در نخ اصلی برایFrameTimingQueryاست. ( Iee0e0 ، b/340206285 )
نسخه ۱.۴.۰-آلفا۰۸
۱۲ فوریه ۲۰۲۵
androidx.benchmark:benchmark-*:1.4.0-alpha08 منتشر شد. نسخه 1.4.0-alpha08 شامل این کامیتها است.
تغییرات API
- APIهای افزونهی
TraceProcessor.runSession()به حالت آزمایشی منتقل شدند، زیرا احتمالاً در نهایت در اندروید به سازندههای عینی تبدیل خواهند شد. ( Ib0528 , b/393640753 ) - بیشتر پیادهسازیهای Startup Insights اکنون عمومی/آزمایشی هستند و به مصنوع
TraceProcessorمنتقل میشوند. بهStartupInsightsمراجعه کنید. ( I0aa00 ) -
BenchmarkRule.runWithTimingDisabled {}به نفعBenchmarkRule.runWithMeasurementDisabled {}منسوخ کنید، که رفتار را واضحتر توصیف میکند - همه معیارها متوقف میشوند. علاوه بر این، سوپرکلاسMicrobenchmarkScopeرا در معرض دید قرار دهید زیرا تعریف مجدد تابعrunWithMeasurementDisabledبرای دسترسی آزاد امکانپذیر نیست، زیرا درونخطی است. ( I9e23b ، b/389149423 ، b/149979716 ) - کتابخانههای بنچمارک به کاتلین ۲.۰ منتقل شدهاند. ( I9d1e0 )
- آرگومان ابزار
androidx.benchmark.startupProfiles.enableحذف شد. دیگر مفید نیست، زیرا میتوان آن را با آرگومانincludeInStartupProfileدرBaselineProfileRule.collect()کنترل کرد. ( I39eb4 )
رفع اشکالات
- تعداد توابع داخلی Microbenchmark که در طول پروفایلینگ فراخوانی میشوند، کاهش یافته است تا مثلاً ردیابی متدها واضحتر شود ( Ifaed8 )
- رفع احتمالی خرابیها: 'متوقف نشد [
ProcessPid(processName=perfetto, pid=...)]'. اکنون Benchmark به جای خرابی، زمانی که یک فرآیند Perfetto در پسزمینه قبل از اجرای معیار قابل توقف نباشد، یک پیام را ثبت میکند. ( I37d3e , b/323601788 ) - رفع
IllegalStateExceptionsبا برچسب 'Expectedpm dump-profilesstdout' که ناشی از بررسی بیش از حد دقیق فرمت خروجی بود. ( I358dc )
نسخه ۱.۴.۰-آلفا۰۷
۲۹ ژانویه ۲۰۲۵
androidx.benchmark:benchmark-*:1.4.0-alpha07 منتشر شد. نسخه 1.4.0-alpha07 شامل این کامیتها است.
ویژگیهای جدید
-
BaselineProfileRuleاکنون یک رابط برنامهنویسی کاربردی (API) به نامcollectWithResults(...)معرفی میکند که شامل فهرستی از مسیرها به پروفایلهای محاسبهشده است. ( I056f8 ) - آرگومان ابزار
androidx.benchmark.measureRepeatedOnMainThread.throwOnDeadlineاضافه شد که میتوان آن را روی false تنظیم کرد تا رفتار throw on deadline مربوط بهmeasureRepeatedOnMainThreadبرای تست محلی غیرفعال شود. در غیر این صورت توصیه نمیشود، زیرا احتمال ANRها را در طول تستها افزایش میدهد. ( Idbeec , b/353226476 )
تغییرات API
-
@JvmOverloadsبه سازندهMicrobenchmarkConfigاضافه شد. ( I13fd3 ) -
BenchmarkRuleبازسازی شده تا بر روی کوروتینها ساخته شود و از رفتارyield()بهتری پشتیبانی کند. این بازسازی چندین API آزمایشیBenchmarkStateرا حذف کرد، اما در صورت نیاز جایگزینهایی نیز به دنبال آن ارائه خواهد شد. علاوه بر این،runWithMeasurementDisabledبرای شفافسازی رفتار (تمام اندازهگیریها متوقف میشود) اضافه شده است. در آینده،runWithTimingDisabledمنسوخ خواهد شد. ( I19837 ، b/389149423 ، b/311242861 ) -
PerfettoTraceProcessorدر یک مصنوع جدیدandroidx.benchmark:benchmark-traceprocessorبهTraceProcessorمنتقل کنید و بیشتر API آن را غیرآزمایشی کنید. هرگونهTraceMetricسفارشی یا هر چیزی که از traces میخواند، باید با import جدیدTraceProcessorبهروزرسانی شود. API جدیدTraceProcessorدقیقاً مانند نسخه قدیمی کار میکند، اما یک کتابخانه رابط مستقل است (تا حدودی مشابه لایهandroidx.sqliteاز Room) با یک پیادهسازی مخصوص اندروید که در macrobenchmark ساخته شده است. مصنوع جدید را میتوان در JVM نیز استفاده کرد، اما در حال حاضر باید کپی خودتان از فایل باینریTraceProcessorرا شروع کنید و یک پورت برای اتصال به آن ارائه دهید. ( I3a767 ، I62563 ، b/381134564 )
رفع اشکالات
- وقتی
MacrobenchmarkScope.startActivityAndWaitدر راهاندازی فرآیند هدف ناموفق است (احتمالاً به دلیل خرابی در فرآیند هدف)، به جای پیام مبهمتر «Unable to confirm activity launch completion» ( I3539b ) یک پیام خطای واضحتر نمایش دهید. - چندین خطای نحوی در نمونههای Kotlin و هایلایت کردن نحو در چندین نمونه Java/build.gradle برطرف شد. ( Ib3808 )
- مستندات پارامترهای
ArtMetricوCaptureInfoشفافسازی شده ( I96e60 )
نسخه ۱.۴.۰-alpha06
۱۱ دسامبر ۲۰۲۴
androidx.benchmark:benchmark-*:1.4.0-alpha06 منتشر شد. نسخه 1.4.0-alpha06 شامل این کامیتها است.
تغییرات API
- استفاده از
@Language("sql") درPerfettoTraceProcessor.Session.query() حذف شد، زیرا برجستهسازی/تجزیه Studio با مشکل مواجه است. ( Idc2fa ، b/377733398 )
رفع اشکالات
- این کتابخانه اکنون از حاشیهنویسیهای nullness از نوع JSpecify استفاده میکند که از نوع استفاده میکنند. توسعهدهندگان کاتلین باید از آرگومان کامپایلر زیر برای اعمال استفاده صحیح استفاده کنند:
-Xjspecify-annotations=strict(این پیشفرض است که از نسخه ۲.۱.۰ کامپایلر کاتلین شروع میشود). ( I46810 ، b/326456246 ) -
ArtMetricاصلاح شد تا بار کلاس (نه init) را گزارش دهد، و مستندات بهبود یافته تا رفتار زمان اجرا را روشن کند. ( I9915c ) - در اندروید چندکاربره، دستورات را فقط در دستگاههای روتشده با دسترسی root اجرا کنید. ( I88b44 )
نسخه ۱.۴.۰-آلفا۰۵
۱۳ نوامبر ۲۰۲۴
androidx.benchmark:benchmark-*:1.4.0-alpha05 منتشر شد. نسخه 1.4.0-alpha05 شامل این کامیتها است.
رفع اشکالات
- مشکلی در API 34+ که در آن
CompilationMode.None()عملکرد متناقضی داشت که نشاندهنده عملکرد اولیه و بدترین حالت نبود، برطرف شد. این مشکل در مورد تغییر پلتفرمی که بهverifyوضعیت کامپایل ART اجازه میدهد تا اندکی پس از اولین اجرا، برنامهها را تا حدی کامپایل کند (فقط بر بارگذاری کلاس تأثیر میگذارد) کار میکند. ( Ie48d0 ) - مشکلی که باعث میشد ردپاهایی (بهویژه کوتاه) ثبت شوند که اندازهگیری را از معیارهای داخلی Macrobenchmark گزارش نمیدادند، برطرف شد، زیرا نام فرآیند در ردپای Perfetto کوتاه شده بود. اکنون macrobenchmark با جستجوی نام بسته کوتاه شده در تمام پرسوجوهای داخلی، علاوه بر نام بسته مورد انتظار، این مشکل را حل میکند. توجه داشته باشید که پیادهسازیهای سفارشی
TraceMetricیا سایر فراخوانیکنندههای مستقیمPerfettoSession.queryمیتوانند همین رفتار را با تغییرprocess.name LIKE "$packageName"در یک پرسوجوی Perfetto به(process.name LIKE "$packageName" OR process.name LIKE "$(packageName.takeLast(15))")پیادهسازی کنند. ( I5bf01 ، b/377565760 )
نسخه ۱.۴.۰-آلفا۰۴
۳۰ اکتبر ۲۰۲۴
androidx.benchmark:benchmark-*:1.4.0-alpha04 منتشر شد. نسخه 1.4.0-alpha04 شامل این کامیتها است.
ویژگیهای جدید
- (آزمایشی) فعال کردن تولید پروفایل پایه و بنچمارکگیری روی برنامههای نصبشده روی یک کاربر ثانویه، مثلاً هر برنامهای روی دستگاههای اندروید اتوی بدون سر. این پشتیبانی در برخی سناریوها آزمایش شده است، اما اگر برای شما کار نمیکند، با یک اشکال به ما اطلاع دهید. ( I9fcbe ، b/356684617 ، b/373641155 )
رفع اشکالات
-
isProfileableاکنون همیشه در بیلدهای بنچمارک لغو میشود، وisDebuggableنیز اکنون همیشه در بیلدهای بنچمارک وnonMinified(ثبت پروفایل پایه) لغو میشود. ( I487fa ، b/369213505 ) - تشخیص کامپایل در برخی از دستگاههای فیزیکی قبل از API 28 را برطرف میکند - بر json
context.compilationModeو همچنین رفتارandroidx.benchmark.requireAot=true(که دیگر به اشتباه اجرا نمیشود) تأثیر میگذارد ( Ic3e08 ، b/374362482 ) - در معیارهای
CpuEventCounter، اگر اندازهگیریهای نامعتبر مشاهده شود (مثلاً instructions/cpucycles==0) مقدار را پرتاب کنید ( I8c503 )
نسخه ۱.۴.۰-آلفا۰۳
۱۶ اکتبر ۲۰۲۴
androidx.benchmark:benchmark-*:1.4.0-alpha03 منتشر شد. نسخه 1.4.0-alpha03 شامل این کامیتها است.
تغییرات API
- Macrobenchmark :
ArtMetricرا اضافه میکند که میتواند برای بررسی پوشش پروفایل یا عملکرد کلی Android RunTime استفاده شود. تعداد و مدت زمان کل JIT، کلاس init (در صورت وجود) و تأیید کلاس را ثبت میکند. علاوه بر این،CaptureInfoتغییر میدهد تا نسخه اصلی ART اختیاری را با پیشفرض در بر بگیرد. ( I930f7 ) - برای نمایش پایداری در یک اجرای معیار مشخص،
coefficientOfVariationبه خروجی JSON معیار اضافه کنید. ( Ib14ea )
رفع اشکالات
- رفع مشکل
CollectBaselineProfileTaskزمانی که دستگاه AVD دارای فاصله (space) بود. ( Ia0225 , b/371642809 ) - رفع احتمالی خطاهای ناشی از استثنائات
StartupMode.COLD:Package <packagename> must not be running prior to cold start!اکنون،MacrobenchmarkScope.killProcess()(شامل یک اجرا قبل از هر تکرار، که برای پیادهسازی رفتارStartupMode.COLDاستفاده میشود) منتظر میماند تا تأیید کند که فرآیندهای برنامه همگی متوقف شدهاند. ( I60aa6 , b/351582215 ) - مشکل نمایش خطای UNLOCKED_ در برخی از شبیهسازهای روتشده برطرف شد. ( Ic5117 )
- این کتابخانه اکنون از حاشیهنویسیهای nullness از نوع JSpecify استفاده میکند که از نوع استفاده میکنند. توسعهدهندگان کاتلین باید از آرگومان کامپایلر زیر برای اعمال استفاده صحیح استفاده کنند:
-Xjspecify-annotations=strict(این پیشفرض است که از نسخه ۲.۱.۰ کامپایلر کاتلین شروع میشود). ( I7104f ، b/326456246 )
نسخه ۱.۴.۰-آلفا۰۲
۲ اکتبر ۲۰۲۴
androidx.benchmark:benchmark-*:1.4.0-alpha02 منتشر شد. نسخه 1.4.0-alpha02 شامل این کامیتها است.
تغییرات API
- وظایف Gradle به
lockClocksوunlockClocksبه جای اینکه در سطح بالا در دسترس باشند، به پروژههای بنچمارک منتقل شدند. این تغییر ضروری بود زیرا متأسفانه هیچ راهی برای ثبت این موارد به عنوان اقدامات سطح بالا بدون شکستن انزوای پروژه وجود ندارد. ( I02b8f , b/363325823 )
رفع اشکالات
-
BaselineProfileRuleاکنون با ارسال سیگنال به هر فرآیند در حال اجرا در انتهای بلوک برای تخلیه پروفایلها، پروفایلهای برنامههای چند فرآیندی را جمعآوری میکند. اگر یک کامپایل مبتنی بر پروفایل هرگز با موفقیت فرآیندی را برای پخش پیدا نکند، کامپایل با شکست مواجه میشود، زیرا وجود دادههای پروفایل در آن غیرمنتظره است. علاوه بر این، یک آرگومان ابزار دقیق برای کنترل مدت زمان انتظار تخلیه اضافه شده است:androidx.benchmark.saveProfileWaitMillis( I0f519 ، b/366231469 ) - از بنچمارک
1.3.2: مشکل آزمایشگاه تست فایربیس (FTL) که نمیتوانست فایلهای نتیجه Baseline Profile یا Macrobenchmark را از افزونه Gradle Baseline Profile دریافت کند، برطرف شد. ( I2f678 ، b/285187547 )
برای استفاده از FTL، افزونه را به ماژول پروفایل پایه در بلوک افزونه اعمال کنید، با:
plugins {
...
id("com.google.firebase.testlab")
}
و سپس آزمایشگاه تست فایربیس را با دستور زیر پیکربندی کنید:
firebaseTestLab {
// Credentials for FTL service
serviceAccountCredentials.set(file("credentials.json"))
// Creates one or more managed devices to run the tests on.
managedDevices {
"ftlDeviceShiba34" {
device = "shiba"
apiLevel = 34
}
}
// Ensures the baseline profile is pulled from the device.
// Note that this will be automated as well later with aosp/3272935.
testOptions {
results {
directoriesToPull.addAll("/storage/emulated/0/Android/media/${android.namespace}")
}
}
}
همچنین دستگاه FTL ایجاد شده باید به افزونه پروفایل پایه اضافه شود:
baselineProfile {
managedDevices += "ftlDeviceShiba34"
useConnectedDevices = false
}
نسخه ۱.۴.۰-آلفا۰۱
۱۸ سپتامبر ۲۰۲۴
androidx.benchmark:benchmark-*:1.4.0-alpha01 منتشر شد. نسخه 1.4.0-alpha01 شامل این کامیتها است.
ویژگی جدید - بینشهای راهاندازی برنامه
- نسخه اولیه بینشهای راهاندازی برنامه را میتوان در Macrobenchmark فعال کرد. ( 09fae38 )
برای فعال کردن در یک بنچمارک راهاندازی:
@Test
fun startup {
macrobenchmarkRule.measureRepeated(
…
packageName = "com.example.my.application.id"
metrics = listOf(StartupTimingMetric()),
iterations = 5,
startupMode = StartupMode.COLD,
compilationMode = CompilationMode.None(),
experimentalConfig = ExperimentalConfig(startupInsightsConfig = StartupInsightsConfig(isEnabled = true))
) {
scope.startActivityAndWait(...)
}
}
سپس اجرای بنچمارک راهاندازی شما، ردیابی را برای یافتن مشکلات رایج تجزیه و تحلیل میکند و آنها را پس از معیارها در خروجی تست استودیو در برگه بنچمارک چاپ میکند، مثلاً:
StartupBenchmark_startup[startup=COLD,compilationMode=None]
├── Metrics
│ ├── timeToFullDisplayMs min 1,147.2, median 1,208.8, max 1,307.4
│ └── timeToInitialDisplayMs min 1,147.2, median 1,208.8, max 1,307.4
├── App Startup Insights
│ ├── App in debuggable mode (expected: false)
│ │ └── seen in iterations: 0(true) 1(true) 2(true) 3(true) 4(true) 5(true) 6(true) 7(true) 8(true) 9(true)
│ ├── Potential CPU contention with another process (expected: < 100000000ns)
│ │ └── seen in iterations: 4(105022546ns)
│ └── Main Thread - Binder transactions blocked (expected: false)
│ └── seen in iterations: 7(true)
└── Traces
└── Iteration 0 1 2 3 4 5 6 7 8 9
این ویژگی هنوز در حال توسعه است و پیشرفتهایی در مستندات و قابلیت توسعه آن در راه است، اما از بازخورد شما استقبال میشود.
ویژگیهای جدید
- ویژگی gradle به نام
androidx.baselineprofile.suppressWarningsبرای سرکوب همه هشدارهای پروفایل پایه اضافه شد. ( 314153a ) - معیارهای میکروبنچ اکنون در ردپاهای Perfetto به عنوان شمارنده نمایش داده میشوند. ( 3214854 )
- اسکریپتهای آزمایشی برای غیرفعال کردن jit (نیازمند روت / راهاندازی مجدد در زمان اجرا) و تنظیم مجدد وضعیت عملکرد/تست دستگاه اضافه کنید. این موارد در حال حاضر به عنوان وظایف gradle منتشر نشدهاند. ( 7c3732b )
- آرگومان بنچمارک برای رد کردن تستها هنگام اجرا روی شبیهساز اضافه شد. وقتی
automaticGenerationDuringbuild فعال باشد، بنچمارکها همچنین باعث تولید پروفایل پایه میشوند. در صورت استفاده از شبیهسازها، این کار با شکست مواجه خواهد شد. با آرگومان جدیدskipBenchmarksOnEmulatorمیتوانیم از تست صرف نظر کنیم. ( 0c2ddcd ) - تغییر رویداد perf، منطق را برای اجرا در API 23+ ( 2550048 ) فعال میکند.
تغییرات API
- آرگومان آزمایشی
PerfettoConfigموجود در تابعMacrobenchmarkRule.measureRepeated()به شیء جدیدExperimentalConfigمنتقل شد.
رفع اشکالات
- افزایش تعداد تلاش مجدد
lockClocks.sh( 99e9dac ) - در صورت وجود، انواع ساخت
nonMinifiedو benchmark را ایجاد نکنید. به دلیل یک اشکال، حتی اگر انواع ساختnonMinifiedو benchmark وجود داشتند، قرار بود دوباره ایجاد شوند. ( e75f0a5 ) - برشهای غیرپایانی را از نتایج
TraceSectionMetricنادیده بگیرید. ( a927d20 ) - بررسی شبیهساز برای در نظر گرفتن پیشوند
sdk_بهبود یافته است. ( 1587de8 ) - بستههای غیر در حال اجرا را به عنوان بستههای پاکشده در
FrameTimingGfxInfoMetricدر نظر بگیرید. ( 35cc79c ) - رفع مشکل تولید مقادیر خراب
androidx.benchmark.cpuEventCounterبرای رویدادهای غیر از دستورالعمل ( 06edd59 ) - رفع مشکل
resumeTiming/runWithTimingDisabledبرای رعایت ترتیب اولویت متریک، و کاهش قابل توجه تأثیر مکث/ادامه متریک با اولویت پایینتر بر نتایج متریک با اولویت بالاتر. برای مثال، اگر از شمارندههای عملکرد پردازنده از طریق آرگومان ابزار دقیقcpuEventCounter.enableاستفاده کنید، زمان Nها دیگر هنگام وقوع مکث/ادامه به طور قابل توجهی کاهش نمییابد. ( 5de0968 )
نسخه ۱.۳
نسخه ۱.۳.۴
۲۶ مارس ۲۰۲۵
androidx.benchmark:benchmark-*:1.3.4 منتشر شد. نسخه ۱.۳.۴ شامل این کامیتها است.
رفع اشکالات
- ناسازگاریهای Gradle Project Isolation در افزونه Benchmark Baseline Gradle برطرف شد. ( b/404523257 )
نسخه ۱.۳.۳
۱۶ اکتبر ۲۰۲۴
androidx.benchmark:benchmark-*:1.3.3 منتشر شد. نسخه 1.3.3 شامل این کامیتها است.
رفع اشکالات
- رفع مشکل
CollectBaselineProfileTaskزمانی که دستگاه AVD دارای فاصله (space) بود ( Ia0225 ، b/371642809 )
نسخه ۱.۳.۲
۲ اکتبر ۲۰۲۴
androidx.benchmark:benchmark-*:1.3.2 منتشر شد. نسخه ۱.۳.۲ شامل این کامیتها است.
رفع اشکالات
- مشکل عدم توانایی آزمایشگاه تست فایربیس (FTL) در دریافت فایلهای نتیجه Baseline Profile یا Macrobenchmark از افزونه Gradle Baseline Profile برطرف شد. ( I2f678 ، b/285187547 )
برای استفاده از FTL، افزونه را به ماژول پروفایل پایه در بلوک افزونه اعمال کنید، با:
plugins {
...
id("com.google.firebase.testlab")
}
و سپس آزمایشگاه تست فایربیس را با دستور زیر پیکربندی کنید:
firebaseTestLab {
// Credentials for FTL service
serviceAccountCredentials.set(file("credentials.json"))
// Creates one or more managed devices to run the tests on.
managedDevices {
"ftlDeviceShiba34" {
device = "shiba"
apiLevel = 34
}
}
// Ensures the baseline profile is pulled from the device.
// Note that this will be automated as well later with aosp/3272935.
testOptions {
results {
directoriesToPull.addAll("/storage/emulated/0/Android/media/${android.namespace}")
}
}
}
همچنین دستگاه FTL ایجاد شده باید به افزونه پروفایل پایه اضافه شود:
baselineProfile {
managedDevices += "ftlDeviceShiba34"
useConnectedDevices = false
}
نسخه ۱.۳.۱
۱۸ سپتامبر ۲۰۲۴
androidx.benchmark:benchmark-*:1.3.1 منتشر شد. نسخه ۱.۳.۱ شامل این کامیتها است.
رفع اشکالات
- ویژگی gradle به نام
androidx.baselineprofile.suppressWarningsبرای سرکوب همه هشدارهای پروفایل پایه ( I7c36e ، b/349646646 ) اضافه شد. - افزونه Gradle پروفایل پایه اصلاحشده برای استفاده از
nonMinified…وbenchmark…از پیش موجود در صورت ایجاد توسط برنامه به جای ایجاد wrapperها. ( Ia8934 , b/361370179 ) - خطای
java.lang.AssertionError: ERRORS (not suppressed): EMULATORهنگام فعال بودنautomaticGenerationDuringBuildدر شبیهسازها برطرف شد. در عوض، از آرگومان جدید برای رد کردن تست استفاده میشود. ( If3f51 ، b/355515798 ) - کوچکسازی میکروبنچمارک - زیرکلاسهای
org.junit.runner.notification.RunListenerرا در کتابخانه بنچمارک proguard ( Ic8ed5 ، b/354264743 ) نگه دارید. - اصلاح
TraceSectionMetricبرای نادیده گرفتن برشهای غیرپایانی. پیش از این، این برشها با مدت زمان -۱ در نظر گرفته میشدند، مثلاً در طول جمعبندی یا یافتن حداقل مدت زمان. ( If74b7 ) - مشکلی در
FrameTimingGfxInfoMetricکه باعث میشد شروع معیار در صورت عدم اجرای فرآیند، متوقف شود، برطرف شد. ( I6e412 )
نسخه ۱.۳.۰
۲۱ آگوست ۲۰۲۴
androidx.benchmark:benchmark-*:1.3.0 منتشر شد. نسخه ۱.۳.۰ شامل این کامیتها است.
تغییرات میکروبنچمارک از نسخه ۱.۲.۰
- ردیابی متد به طور پیشفرض در میکروبنچمارکها هنگام اجرا روی اکثر دستگاهها فعال است.
- ردیابی روش به عنوان یک مرحله جداگانه، پس از اندازهگیریها اجرا میشود - این امر باعث میشود اندازهگیریهای دقیق و ردیابی روشها هر دو از یک اجرای معیار واحد خروجی گرفته شوند.
- ردیابی روش در برخی از نسخههای سیستم عامل اندروید و ART بر مراحل اندازهگیری بعدی تأثیر میگذارد - در این نسخهها، ردیابی روش به طور پیشفرض خاموش است و یک هشدار در خروجی استودیو چاپ میشود.
- بنچمارکهای نخ اصلی و ANRها
- برای معیارهای نخ رابط کاربری (مثلاً آنهایی که با رابطهای کاربری Compose/View تعامل دارند)
measureRepeatedOnMainThreadاضافه شد تا از ANRها هنگام اجرا برای چند ثانیه جلوگیری شود. - اگر انتظار برود که از مهلت اجتناب از ANR تجاوز کند، ردیابیهای متد نادیده گرفته میشوند. برای غیرفعال کردن این رفتار،
androidx.benchmark.profiling.skipWhenDurationRisksAnrرا روی false تنظیم کنید (برای اجراهای CI توصیه نمیشود، زیرا ANRها میتوانند در اجراهای طولانی CI مشکل ایجاد کنند).
- برای معیارهای نخ رابط کاربری (مثلاً آنهایی که با رابطهای کاربری Compose/View تعامل دارند)
- کوچکسازی
- قوانین پروگارد تعبیهشده برای بهبود میکروبنچمارکینگ با فعالسازی کوچکسازی
- Minification/R8 در یک ماژول کتابخانهای به AGP 8.3 نیاز دارد و میتواند از طریق
android.buildTypes.release.androidTest.enableMinificationدرbuild.gradleشما فعال شود. - API آزمایشی
BlackHole.consume()برای جلوگیری از حذف کدهای مرده اضافه شد ( If6812 , b/286091643 )
- معیارها
- ویژگی شمارنده رویداد پردازنده آزمایشی (معیارها از
perf_event_open، که در اکثر نسخههای پلتفرم به روت نیاز دارد)، دسترسی از طریقInstrumentationArgumentandroidx.benchmark.cpuEventCounter.enable(میتواند رویtrueتنظیم شود) وandroidx.benchmark.cpuEventCounter.eventsرا میتوان مثلاً روی (Instructions,CpuCycles) تنظیم کرد. این باید در برخی از شبیهسازهای userdebug پشتیبانی شود، اما پشتیبانی در تمام شبیهسازهای موجود آزمایش نشده است.
- ویژگی شمارنده رویداد پردازنده آزمایشی (معیارها از
تغییرات MACRObenchmark از نسخه ۱.۲.۰
- بازنگری ردیابی روش برای ماکروبنچمارکها.
- اکنون ردیابی متدها به مدت زمان
measureBlockمحدود میشود و اگر فرآیند چندین بار شروع شود، میتواند چندین جلسه را ضبط کند. - پیش از این، ردیابی متد فقط برای بنچمارکهای
StartupMode.COLDکار میکرد و برایmeasureBlocksکه فرآیند هدف را مجدداً راهاندازی نمیکردند، چیزی ثبت نمیکرد. - ردیابیهای متد اصلاحشده در ماکروبنچمارک همسطح میشوند، بنابراین ردیابیهای متد باید بهطور کامل ثبت و معتبر باشند، حتی در دستگاههای کندتر. ( I6349a ، b/329904950 )
- اکنون ردیابی متدها به مدت زمان
- به درستی پروفایل ART را در طول تکرارهای
warmUpجداگانه، زمانی که فرآیند از بین میرود، تخلیه میکند تا اندازهگیریهایCompilationMode.Partial(warmup=N)دقیقتر باشند. ( I17923 ) - پیام خرابی پخش Drop Shader
- پیشنهادهای اشکالزدایی برای حذف پیام خطای پخش سایهزن اضافه شد
- دو آرگومان ابزار دقیق برای لغو رفتار رها کردن سایهزن برای حل مشکل خرابیها هنگام بنچمارکگیری از برنامهها بدون
ProfileInstaller1.3 اضافه کنید:-
androidx.benchmark.dropShaders.enable=true/false: میتواند برای صرف نظر کردن از حذف تمام سایهزنها (از جمله مواردی که درStartupMode.Coldlaunchs انجام میشود) استفاده شود، به خصوص هنگام بنچمارک برنامههایی که هنوز از profileinstaller 1.3 استفاده نمیکنند. -
androidx.benchmark.dropShaders.throwOnFailure=true/false: میتواند برای تحمل خطاها هنگام تلاش برای حذف سایهزنها استفاده شود، به عنوان مثال هنگام بنچمارکگیری برنامهها بدون profileinstaller 1.3 ( I4f573 )
-
- نوع آزمایشی
MacrobenchmarkRule#measureRepeatedاضافه شد که برای ضبط ردیابی Perfetto کاملاً سفارشی، یکPerfettoConfigسفارشی میگیرد. توجه داشته باشید که پیکربندیهای نادرست پیکربندی شده ممکن است باعث از کار افتادن کلاسهای Metric داخلی شوند. ( Idfd3d ، b/309841164 ، b/304038384 ) - قبل از اجرای یک Macrobenchmark، کارهای dexopt پسزمینه را لغو کنید تا تداخل کاهش یابد. ( I989ed )
- Macrobenchmark اکنون ۱ ثانیه منتظر میماند تا برنامهی هدف، پروفایل ART را پاک کند (قبلاً ۵۰۰ میلیثانیه منتظر میماند). ( I85a50 ، b/316082056 )
- بازنگری اساسی TraceSectionMetric
- توجه : تغییرات
TraceSectionMetricزیر میتواند بر خروجیها در استفاده از CI تأثیر بگذارد و ممکن است ناپیوستگی ایجاد کند یا تجزیه را مختل کند. - اکنون Sum پیشفرض است، زیرا بیشتر استفاده از این معیار برای رویدادهای تکراری است و first دادهها را در این موارد حذف میکند.
- تغییر یافته تا قابل تنظیمتر باشد، با حالتهای موجود بیشتر
- نام حالتها اکنون در نام خروجی متریک (در استودیو و JSON) تعبیه شدهاند.
- اکنون از برشهای ایجاد شده با استفاده از
Trace.{begin|end}AsyncSectionپشتیبانی میکند.
- توجه : تغییرات
- معیارها
- قدرت - اضافه شدن
PowerMetric.deviceSupportsHighPrecisionTracking،PowerMetric.deviceBatteryHasMinimumCharge()وPowerMetric.deviceSupportsPowerEnergy() - برای مطابقت با نوع بازگشتی،
Metric.getResultبهgetMeasurementsتغییر نام داد. - برچسبهای log.w / exception به همه خطاهای تشخیص راهاندازی اضافه شد. این کار رفتار فعلی را تغییر نمیدهد (بنابراین برخی خطاها رخ میدهند و برخی دیگر به طور خاموش در تشخیص راهاندازی ناموفق هستند)، فقط آن را قابل فهمتر میکند. به طور کلی مواردی که
Log.w()و معیارهای راهاندازی را گزارش نمیکنند، مواردی هستند که رویدادهای غیر فریمی از دست رفتهاند، هنگام شناسایی راهاندازی به جز اطلاعات زمانبندی فریم (از برشهای UI/RT) استثناهایی رخ میدهد. ( Id240f ، b/329145809 ) - اندازهگیری
frameCountبهFrameTimingMetricاضافه شد تا به کشف سناریوهایی که در آنها اندازهگیریها به دلیل تغییر تعداد فریمهای تولید شده تغییر میکنند، کمک کند (انیمیشنهای جدید اضافه شد، مشکلات نامعتبرسازی برطرف شد). ( I1e5aa ) - توضیح داده شد که
frameOverrunMsمعیار ترجیحی برای ردیابی در صورت وجود در اسناد است و دلیل آن چیست. ( I18749 ، b/329478323 ) - مشکلی که باعث میشد فریمهای پایان نیافته در ابتدا و انتهای ردیابی با هم جفت شوند و به اشتباه به عنوان یک فریم بسیار طولانی گزارش شوند، برطرف شد. ( I39353 ، b/322232828 )
- خطای
FrameTimingMetricرا هنگام تولید نشدن فریمها بهبود بخشید، و همیشه هنگام عدم موفقیت در تجزیه متریک، لینک را برای ردیابی خروجی دهید تا به تشخیص مشکل کمک کند. ( I956b9 ) - مشکل کرش کردن
FrameTimingMetricکه باعث میشد نتواند شناسه فریم را تجزیه کند، مخصوصاً در برخی از دستگاههای OEM، برطرف شد. ( Ia24bc ، b/303823815 ، b/306235276 ) - سختگیری در بررسیها در
FrameMetricsکاهش یافت و جزئیات بیشتری به پیامهای خطا اضافه شد. ( Iadede )
- قدرت - اضافه شدن
تغییرات افزونه Gradle از نسخه ۱.۲.۰ به بعد در ثبت پروفایل پایه / Gradle
- حداکثر نسخه پیشنهادی AGP به 9.0.0-alpha01 افزایش یافته است.
- مطمئن شوید که وظایف
mergeArtProfileوmergeStartupProfileهمیشه منتظر تولید پروفایل پایه باشند. ( I623d6 , b/343086054 ) - تولید موفقیتآمیز یک پروفایل پایه، خلاصهای از تغییرات را نمایش میدهد ( I824c8 ، b/269484510 )
- اضافه شدن DSL برای غیرفعال کردن هشدارها ( Ic4deb ، b/331237001 )
- رفع اشکالی که تضمین میکرد معیارها از پروفایلهای خط پایه تولید شده هنگام خاموش بودن
automaticGenerationDuringBuildاستفاده کنند ( Ic144f ، b/333024280 ) - رفع مشکل لغو شدن ویژگی افزونه
BaselineProfilegradle برای فعال کردن تولید پروفایل پایه و بنچمارک هنگام سفارشیسازی نوع ساختnonMinifiedیا benchmark. ( Ib8f05 ، b/324837887 ) - رفع مشکل گنجاندن پروفایلهای خط پایه کتابخانه در AAR قبل از AGP 8.3.0-alpha15. ( I1d2af ، b/313992099 )
- آدرس خروجی خط پایه و پروفایل راهاندازی در پایان وظیفه تولید اصلاح شد. ( I802e5 ، b/313976958 )
سایر تغییرات قابل توجه از زمان ۱.۲.۰
- ردیابی ضبط
- کاهش خطای EXITCODE 2 هنگام شروع perfetto از یک خطا به هشدار ثبت شده
- فعال کردن ردیابی AIDL به صورت پیشفرض در بنچمارکها (نیازمند API 28) ( Ia0af2 ، b/341852305 )
- ردیابی برچسبهای porter را به طور پیشفرض در بنچمارکها فعال کنید. این مورد، به عنوان مثال، نقاط ردیابی wakelock را ثبت میکند. ( Icfe44 ، b/286551983 )
- افزایش زمان شروع ضبط ردیابی برای جلوگیری از خرابی هنگام شروع ردیابی در دستگاههای کندتر ( I98841 ، b/329145808 )
- APIهای عمومی
PerfettoTraceProcessor.Session.queryMetricsبا انواع JSON، textproto و proto binary (رمزگشایی نشده) اضافه شدند. این APIها به شما امکان میدهند معیارهای تعبیهشده درTraceProcessor( I54d7f ، b/304038382 ) را جستجو کنید. - فعال کردن شروع مسدودسازی در رکورد ردیابی Perfetto برای کاهش خطر از دست رفتن دادهها در ابتدای ردیابی. فقط در API 33+ پشتیبانی میشود. ( Ie6e41 ، b/310760059 )
- خروجی JSON
- اطلاعات اضافی در زمینه معیار در خروجی JSON اضافه شد:
-
context.artMainlineVersion- نسخه صحیح ماژول Art mainline (در صورت وجود در دستگاه، در غیر این صورت-1) -
context.build.id- برابر با android.os.Build.ID -
context.build.version.codename- برابر است با android.os.Build.VERSION.CODENAME -
context.build.version.abbreviatedCodename- معادل حرف اول نام کد قبل از انتشار (شامل نسخههای منتشر شده) است ( Ie5020 )
-
- لیست
profilerOutputبه خروجی JSON اضافه شد تا ابزارهای اطراف ردیابیهای پروفایلینگ (مثلاً Perfetto، ردیابیهای Method) آسانتر شوند ( I05ddd ، b/332604449 ) - هنگام استفاده از Android Test Orchestrator در ماژولهای بنچمارک، هشداری اضافه شد، زیرا این امر باعث میشود فایلهای JSON خروجی هر ماژول بارها و بارها رونویسی شوند. ( Ia1af6 , b/286899049 )
- وقتی نام فایلها بیش از ۲۰۰ کاراکتر باشد، برای جلوگیری از خرابیهای نامشخص هنگام نوشتن یا پردازش پس از پردازش فایلها، پرتاب میشود. ( I4a5ab )
- اطلاعات اضافی در زمینه معیار در خروجی JSON اضافه شد:
نسخه ۱.۳.۰-rc01
۷ آگوست ۲۰۲۴
androidx.benchmark:benchmark-*:1.3.0-rc01 منتشر شد. نسخه 1.3.0-rc01 شامل این کامیتها است.
رفع اشکالات
- رفع مشکل تولید مقادیر خراب
androidx.benchmark.cpuEventCounterبرای رویدادهای غیر از دستورالعمل ( I7386a ، b/286306579 ) - رفع مشکل
resumeTiming/runWithTimingDisabledبرای رعایت ترتیب اولویت متریک، و کاهش قابل توجه تأثیر مکث/ادامه متریک با اولویت پایینتر بر نتایج متریک با اولویت بالاتر. برای مثال، اگر از شمارندههای عملکرد پردازنده از طریق آرگومان ابزارcpuEventCounter.enableاستفاده کنید، زمان Nها دیگر هنگام وقوع مکث/ادامه به طور قابل توجهی کاهش نمییابد. ( I39c2e ، b/286306579 ، b/307445225 ) - با انتقال تبدیل نمونهگیری پشته از نخ اصلی، احتمال اینکه نمونهبرداری پشته باعث شود
measureRepeatedOnMainThreadبه وقفه سخت نخ اصلی برخورد کند، کاهش یافت. ( I487a8 ، b/342237318 ) - حذف دستورالعمل دسترسی به APIهای پلتفرم جدید، زیرا این امر به طور خودکار از طریق مدلسازی API هنگام استفاده از R8 با AGP 7.3 یا بالاتر (مثلاً R8 نسخه 3.3) و برای همه نسخهها هنگام استفاده از AGP 8.1 یا بالاتر (مثلاً D8 نسخه 8.1) اتفاق میافتد. به مشتریانی که از AGP استفاده نمیکنند، توصیه میشود به D8 نسخه 8.1 یا بالاتر بهروزرسانی کنند. برای جزئیات بیشتر به این مقاله مراجعه کنید. ( I9496c ، b/345472586 )
- Added agp version check to send package name as instr arg. Previous to AGP 8.4.0 the target app package name cannot be send to the instrumentation app via instrumentation arguments. ( 0c72a3f )
Version 1.3.0-beta02
July 10, 2024
androidx.benchmark:benchmark-*:1.3.0-beta02 is released. Version 1.3.0-beta02 contains these commits .
رفع اشکالات
- Gracefully handle EXITCODE
2when starting Perfetto to log a warning, but proceed.
Version 1.3.0-beta01
۱۲ ژوئن ۲۰۲۴
androidx.benchmark:benchmark-*:1.3.0-beta01 is released. Version 1.3.0-beta01 contains these commits .
API Changes
- Renamed
MethodTracing.affectsMeasurementOnThisDevicetoAFFECTS_MEASUREMENT_ON_THIS_DEVICEfor consistency. ( I1bdfa ) - Added experimental
BlackHole.consume()api to prevent dead code elimination in microbenchmarks. ( If6812 , b/286091643 ) - Microbenchmark will now correctly throw to prevent method tracing from interfering with measurements. This occurs on certain devices when method tracing is forced on (via instrumentation args or
MicrobenchmarkConfig), and if a measurement is attempted after a method trace. Affected devices are running API 26-30 or certain ART mainline module versions affected by this interference, and can be detected at runtime viaProfilerConfig.MethodTracing.affectsMeasurementOnThisDevice. ( Iafb92 , b/303660864 )
رفع اشکالات
- Bumped max agp version recommended to 9.0.0-alpha01. ( I5bbb0 )
- Added compilation mode to benchmark context ( If5612 , b/325512900 )
- Enable AIDL tracing by default (requires API 28) ( Ia0af2 , b/341852305 )
- Added additional information in benchmark context in JSON output:
-
context.artMainlineVersion- integer version of Art mainline module (if present on device, -1 otherwise) -
context.build.id- Equalsandroid.os.Build.ID -
context.build.version.codename- Equalsandroid.os.Build.VERSION.CODENAME -
context.build.version.abbreviatedCodename- corresponds to first letter of pre-release codename (even on release builds) ( Ie5020 )
-
- Fixes
StackSamplingto respectandroidx.benchmark.profiling.sampleDurationSeconds( Ib1d53 ) - Change macro->common dependency to be
api(), so it's easier to use egPerfettoTraceandPerfettoConfig. ( Icdae3 , b/341851833 ) - Ensure
mergeArtProfileandmergeStartupProfiletasks always wait for baseline profile generation. ( I623d6 , b/343086054 ) - Consider variant enable state when deciding whether variant should be enabled. ( I5d19e , b/343249144 )
- Increased default start timeout for perfetto trace processor. ( I87e8c , b/329145808 )
Version 1.3.0-alpha05
۱۴ مه ۲۰۲۴
androidx.benchmark:benchmark-*:1.3.0-alpha05 is released. Version 1.3.0-alpha05 contains these commits .
رفع اشکالات
- Throw clearer exception when macrobench metric returns zero values for all iterations ( Iab58f , b/314931695 )
- Additional workaround rules added to microbench proguard rules, including support for listener rules and other observed warnings / errors. ( I14d8f , b/329126308 , b/339085669 )
- Method tracing runs as a separate phase during a Macrobenchmark, and it no longer affects measurements. ( If9a50 , b/285912360 , b/336588271 )
- Added extra debugging suggestions to drop shader broadcast failure message. ( I5efa6 , b/325502725 )
Version 1.3.0-alpha04
۱ مه ۲۰۲۴
androidx.benchmark:benchmark-*:1.3.0-alpha04 is released. Version 1.3.0-alpha04 contains these commits .
API Changes
- Added experimental
MacrobenchmarkRule#measureRepeatedvariant which takes a customPerfettoConfigfor fully customized Perfetto trace recording. Note that incorrectly configured configs may cause built in Metric classes to fail. ( Idfd3d , b/309841164 , b/304038384 ) - Rename
PowerMetric.deviceSupportsPowerEnergytoPowerMetric.deviceSupportsHighPrecisionTrackingfor clarity ( I5b82f ) - Added
PowerMetric.deviceBatteryHasMinimumCharge()andPowerMetric.deviceSupportsPowerEnergy()to enable changing or skipping benchmarks based on device power measurement capability. ( I6a591 , b/322121218 )
رفع اشکالات
- Added comparison with previous baseline profile ( I824c8 , b/269484510 )
- Added DSL to disable warnings ( Ic4deb , b/331237001 )
- Changed exception to info log when benchmark variants are disabled ( I8a517 , b/332772491 )
- Make it simpler to capture method traces for a Macrobenchmark is scoped to the duration of the actual
measureBlock(). Previously, it started at target process launch and only supported cold starts ( Iee85a , b/300651094 ) - Avoid crashing when perfetto trace processor is slow to start ( I98841 , b/329145808 )
Version 1.3.0-alpha03
۱۷ آوریل ۲۰۲۴
androidx.benchmark:benchmark-*:1.3.0-alpha03 is released. Version 1.3.0-alpha03 contains these commits .
ویژگیهای جدید
- Adds public API
PerfettoTraceProcessor.Session.queryMetricsAPIs with JSON, textproto, and proto binary (undecoded) variants. These allow you to query metrics built into TraceProcessor ( I54d7f , b/304038382 ) - Added
profilerOutputto JSON output for easier tooling around profiling traces (eg perfetto, method traces). ( I05ddd , b/332604449 ) - Added power tag to benchmark Perfetto Config. This captures, for example, wakelock tracepoints. ( Icfe44 , b/286551983 )
- Added inst argument
androidx.benchmark.profiling.skipWhenDurationRisksAnr, can be set to false to avoid skipping method traces when expected duration may cause an ANR - strongly recommended to avoid in CI runs. - Added experimental inst argument
androidx.benchmark.profiling.perfCompare.enable, set this to true to run comparison timing between measurement and profiling phases. Useful in eg evaluating overhead of method tracing. ( I61fb4 , b/329146942 )
API Changes
- Changed
TraceSectionMetric.Modeto sealed class to enable future expansion without breaking exhaustive when statements ( I71f7b ) - Added
TraceSectionMetric.Mode.Averageand.Count, and reordered args so the more common argument (mode) was earlier in the arg list, reducing need for specifying parameter names. ( Ibf0b0 , b/315830077 , b/322167531 ) - Renamed
Metric.getResulttogetMeasurementsto match return type ( I42595 )
رفع اشکالات
- Fix to ensure benchmarks use generated baseline profiles when
automaticGenerationDuringBuildis off ( Ic144f , b/333024280 ) - Fix
BaselineProfilegradle plugin property overrides to enable baseline profile generation and benchmarking when customizing anonMinifiedor benchmark build type. ( Ib8f05 , b/324837887 ) - Fixed method traces flush in macrobenchmark, so that method traces should be fully captured and valid, even on slower devices. ( I6349a , b/329904950 )
- Enable blocking start on Perfetto trace record to reduce risk of missing data at beginning of trace. Only supported on API 33+. ( Ie6e41 , b/310760059 )
- Added a warning when Android Test Orchestrator is used in benchmark modules, as this will cause per-module output JSON files to be repeatedly overwritten. ( Ia1af6 , b/286899049 )
- Force ',' (comma) thousands separators for consistency in Studio output, ignoring device locale ( I3e921 , b/313496656 )
-
TraceSectionMetricnow supports slices created usingTrace.{begin|end}AsyncSection. ( I91b32 , b/300434906 ) - Added log.w / exception labels to all startup detection failures. This does not change current behavior (so some errors throw, and others silently fail to detect the startup), just makes it more understandable. Generally the ones that
Log.w()and fail to report startup metrics are those where non-frame events are missing, exceptions are thrown when startup is detected except for frame timing information (from UI/RT slices). ( Id240f , b/329145809 ) - Cancel background dexopt jobs before running a Macrobenchmark to reduce interference. ( I989ed )
- Added
frameCountmeasurement toFrameTimingMetricto aid in discovery of scenarios where measurements change because the number of frames produced changed (new animations added, invalidation issues fixed). ( I1e5aa ) - Clarified that
frameOverrunMsis the preferred metric for tracking when available in docs, and why. ( I18749 , b/329478323 )
Version 1.3.0-alpha02
۲۰ مارس ۲۰۲۴
androidx.benchmark:benchmark-*:1.3.0-alpha02 is released. Version 1.3.0-alpha02 contains these commits .
ویژگیهای جدید
Experimental R8 support in microbench via embedded proguard rules. Note that this support is experimental, and requires AGP 8.3 for minification of library module tests. Use the following to enable R8 minification/optimization in your benchmark module's
build.gradle, which should lead to a significant performance increase, depending on workload. ( I738a3 , b/184378053 )android { buildTypes.release.androidTest.enableMinification = true }
رفع اشکالات
- Fixes method tracing warning to be on separate line from microbench output. ( I0455c , b/328308833 )
Version 1.3.0-alpha01
۲۱ فوریه ۲۰۲۴
androidx.benchmark:benchmark-*:1.3.0-alpha01 is released. Version 1.3.0-alpha01 contains these commits.
API Changes
- Renamed
MicrobenchmarkConfigboolean parameters to avoid unnecessary word 'should' ( Ia8f00 , b/303387299 ) - Added
BenchmarkRule.measureRepeatedOnMainThreadso main thread benchmarks (eg ones touching Views or Compose UIs) can avoid triggering ANRs, especially during large suites in CI. ( I5c86d ) - Added
FrameTimingGfxInfoMetric, an experimental alternate implementation ofFrameTimingMetricwith measurements coming directly from the platform, rather than extracted from the Perfetto trace. ( I457cb , b/322232828 ) - Add the ability to dump an ART profile during individual
warmUpiterations. ( I17923 ) - Several changes to
TraceSectionMetricAPI:- Add
Mode.Min,Mode.Max - Add label argument to override section name as metric label
- Added mode name to output to clarify metric meaning
- Changed default to sum, as most usage of this metric is for repeated events Be aware of this changes in CI usage, as it may create discontinuities or break parsing. ( Ic1e82 , b/301892382 , b/301955938 )
- Add
رفع اشکالات
- Improved error message in baseline profile gradle plugin when specified managed device does not exist ( Idea2b , b/313803289 )
- Fix for including library baseline profiles in AAR prior to AGP 8.3.0-alpha15 ( I1d2af , b/313992099 )
- Fixed baseline and startup profile output url at the end of generation task ( I802e5 , b/313976958 )
- Adjusted data source timeouts to attempt to fix
java.lang.IllegalStateException: Failed to stop [ProcessPid(processName=perfetto, pid=...)]( I8dc7d , b/323601788 ) - Add two instrumentation arguments for overriding shader dropping behavior to workaround crashes when benchmarking apps without
ProfileInstaller1.3:-
androidx.benchmark.dropShaders.enable=true/false: can be used to skip all shader dropping (including that done inStartupMode.Coldlaunches), esp when benchmarking apps that don't yet use profileinstaller 1.3 -
androidx.benchmark.dropShaders.throwOnFailure=true/false: can be used to tolerate failures when trying to drop shaders, for example when benchmarking apps without profileinstaller 1.3 ( I4f573 )
-
- Skip method tracing on UI thread when expected to take longer than a few seconds, and cleanup method traces when throwing. ( I6e768 )
- Throw when filenames are longer than 200 chars to avoid unclear crashes when writing or post-processing files. ( I4a5ab )
- Fixes issue where unterminated frames at the beginning and end of the trace could be paired together, which would incorrectly report as a single extremely long frame. ( I39353 , b/322232828 )
- Use
--skip verificationon API 30+ when reinstalling a package on API 30-33 to clear ART profiles on user builds. This helps bypass Play Protect warnings that cause failures on some class of devices. ( Ic9e36 ) - Use
am force-stopto kill apps when not a system app like System UI or Launcher. ( I5e028 ) - Macrobenchmark now waits for
1 secondfor the target application to flush an ART profile (previously it waited for500 ms). ( I85a50 , b/316082056 ) - Improve
FrameTimingMetricerror when frames aren't produced, and always output link to trace when failing metric parsing to assist in diagnosing problem. ( I956b9 ) - Fixed crash in
FrameTimingMetricfailing to parse frame id, especially on certain OEM devices. ( Ia24bc , b/303823815 , b/306235276 ) - Relaxed strictness of checks in
FrameMetrics, and added more detail to error messages. ( Iadede )
Version 1.2
Version 1.2.4
۱۷ آوریل ۲۰۲۴
androidx.benchmark:benchmark-*:1.2.4 is released. Version 1.2.4 contains these commits .
رفع اشکالات
- Fixes baseline profile srcset not being set up in benchmark variants. Also fixes
automaticGenerationDuringBuildin libraries causing a circular dependency. ( I28ab7 , b/333024280 ) - Use
am force-stopto kill apps when not a system app like System UI or Launcher. This fixesStartupMode.COLDbenchmarks crashing from "Package $package must not be running prior to cold start!" due to process kill not fully succeeding. ( I5e028 )
نسخه ۱.۲.۳
January 24, 2024
androidx.benchmark:benchmark-*:1.2.3 is released. Version 1.2.3 contains these commits.
رفع اشکالات
- Removed exception from Baseline Profile Gradle Plugin when AGP version is 8.3.0 or higher.
- Fix for including library baseline profiles in AAR prior to AGP 8.3.0-alpha15.
نسخه ۱.۲.۲
۱ دسامبر ۲۰۲۳
androidx.benchmark:benchmark-*:1.2.2 is released. Version 1.2.2 contains these commits.
Baseline Profiles
- Execution logs will show the baseline profile output file path as a local file URI ( aosp/2843918 , aosp/2853665 , b/313976958 )
نسخه ۱.۲.۱
۱۵ نوامبر ۲۰۲۳
androidx.benchmark:benchmark-*:1.2.1 is released. Version 1.2.1 contains these commits.
ویژگیهای جدید
- Improved error message when user disables test variants ( b/307478189 )
- Added properties to support AS test run integration ( b/309805233 ), ( b/309116324 )
Version 1.2.0
۱۸ اکتبر ۲۰۲۳
androidx.benchmark:benchmark-*:1.2.0 is released. Version 1.2.0 contains these commits.
Important changes since 1.1.0
Baseline Profiles
- New Baseline Profile Gradle Plugin automates capturing and including baseline profiles in your test and build workflow.
-
BaselineProfileRule.collectnow stable, a streamlined and simplified version of the previous experimentalBaselineProfileRule.collectBaselineProfileAPI- Just specify
packageName, and drive your app
- Just specify
- For libraries generating baseline profiles, you can now filter the rules generated either in code (
BaselineProfileRule.collectargument), or even more simply in the gradle plugin - رفع اشکالات
- Fixed baseline profile collection on Android U+ ( Id1392 , b/277645214 )
Macrobenchmark
- گردآوری
- Macrobenchmark now correctly fully resets compilation state for each compile - this requires reinstalling the APK prior to Android 14, so benchmarking on Android 14+ is strongly recommended if you want to persist state (like user login) in what's being measured.
- You can also work around this by controlling app compilation separately, and skipping compilation with
CompilationMode.Ignore()or instrumentation argument
Instrumentation Arguments
- Support for
androidx.benchmark.dryRunMode.enableinstrumentation argument, (already available in microbenchmark) for quicker validation runs (eg when creating the benchmark, or in presubmit) - Support for
androidx.benchmark.profiling.mode=StackSamplingandMethodTracing. - Added
androidx.benchmark.enabledRulesto allow runtime filtering baseline profile vs macrobenchmark rule tests - Added
androidx.benchmark.perfettoSdkTracing.enableargument to enable tracing with tracing-perfetto, eg Compose recomposition tracing. Note that when used withStartupMode.COLD, timing will be significantly affected as the tracing library is loaded and enabled during app startup.
- Support for
الزامات
- Macrobenchmark now requires
ProfileInstaller1.3.0 or greater in the target app, to enable profile capture / reset, and shader cache clearing.
- Macrobenchmark now requires
New Experimental Metric APIs
- Added experimental
TraceSectionMetric, which allows for extracting simple timing fromtrace("") {}blocks in your app, or TraceMetric for leveraging the full query capability of PerfettoTraceProcessor. - Added experimental
PowerMetricto capture power usage information - Added experimental
MemoryCountersMetricto count page faults - Added experimental
PerfettoTraceProcessorAPI, which is used internally to extract metrics from System traces (aka Perfetto traces)
- Added experimental
رفع اشکالات
- Fixed crashes when installing or extracting profiles from an app installed from multiple APKs (eg from app bundle).
- Fixed
FrameTimingMetricignoring frames with inconsistent frame IDs (generally, frames during ripples on API 31+) ( I747d2 , b/279088460 ) - Fixed parsing errors on traces > 64MB ( Ief831 , b/269949822 )
- Clarified errors when device (especially emulator) OS image not correctly configured for tracing, or compilation
- Skip battery level check for devices without battery (micro and macro)
- Improved file output, with more clear errors for invalid output directories, and safer defaults
- Improved stability of
StartupMode.COLDby consistently dropping the shader cache (also exposed viaMacrobenchmarkScope.dropShaderCache) - Fixed leanback fallback for
startActivityAndWait.
Microbenchmark
- ویژگیها
- Profiling was moved to a separate phase, after other metrics, so one test run can display both accurate timing and profiling results.
- Experimental APIs
- Added experimental
MicrobenchmarkConfigAPI for defining custom metrics and configuring tracing and profiling. Can be used to capture method traces, or capture tracepoints (but be aware of tracing overhead). - Added experimental APIs for controlling
BenchmarkStateseparately fromBenchmarkRule, without JUnit - Added experimental
PerfettoTracerecord to enable capturing Perfetto traces, with custom configuration, separate from benchmark APIs.
- Added experimental
- رفع اشکالات
- Workaround missing leading whitespaces in Android Studio benchmark output.
- Fix issue where warnings could fail to print in Android Studio benchmark output.
- Fixed
SampledProfilingcrash on Android 13 (API 33) and higher. - Massively improved performance of
dryRunModeby skippingIsolationActivityand Perfetto tracing (Up to 10x faster dry run mode on older OS versions).
Version 1.2.0-rc02
۶ اکتبر ۲۰۲۳
androidx.benchmark:benchmark-*:1.2.0-rc02 is released. Version 1.2.0-rc02 contains these commits.
رفع اشکالات
- Fix Benchmark file output to no longer break
BaselineProfilePlugin file copying. Files were generated and copied off device, but had been renamed such that the gradle plugin wouldn't see them. ( I8dbcc , b/303034735 , b/296453339 ) - Clarified
tracing-perfettoloading error messages when injecting from macrobenchmark module into target application.
Version 1.2.0-rc01
۲۰ سپتامبر ۲۰۲۳
androidx.benchmark:benchmark-*:1.2.0-rc01 is released. Version 1.2.0-rc01 contains these commits.
رفع اشکالات
- An exception (with remedy instructions) is now thrown when Perfetto SDK tracing fails to initialize in a Benchmark. ( I6c878 , b/286228781 )
- Fix OOM crash when converting ART method trace -> perfetto format. ( I106bd , b/296905344 )
- (Macrobenchmark) Clarified method tracing label when linked in Studio test output, and fixed method tracing filenames to be unique on device/host, so they won't be overwritten when more than one benchmark is run. ( I08e65 , b/285912360 )
- Ensures that the device is awake when capturing a baseline profile. ( I503fc )
Version 1.2.0-beta05
۳۰ آگوست ۲۰۲۳
androidx.benchmark:benchmark-*:1.2.0-beta05 is released. Version 1.2.0-beta05 contains these commits.
ویژگیهای جدید
- The Baseline Profile Gradle Plugin now supports Android Gradle Plugin 8.3. ( aosp/2715214 )
Version 1.2.0-beta04
۲۳ آگوست ۲۰۲۳
androidx.benchmark:benchmark-*:1.2.0-beta04 is released. Version 1.2.0-beta04 contains these commits.
ویژگیهای جدید
- The Baseline Profiles Gradle plugin now supports Android Gradle Plugin 8.3. ( aosp/2715214 )
رفع اشکالات
- Fix failures in writing / moving and pulling files (especially those from parameterized tests) by sanitizing output file names further, avoiding '=' and ':' in output file names. ( I759d8 )
Version 1.2.0-beta03
۹ آگوست ۲۰۲۳
androidx.benchmark:benchmark-*:1.2.0-beta03 is released. Version 1.2.0-beta03 contains these commits.
API Changes
- Added argument to filter
TraceSectionMetricto only the target package, on by default ( Ia219b , b/292208786 )
رفع اشکالات
- Renamed
fullTracing.enableinstrumentation argument toperfettoSdkTracing.enablefor consistency with artifact name, and other references.fullTracing.enablewill continue to work as a fallback. ( I7cc00 ) - Benchmark library internal tracepoints (including microbenchmark loop/phase tracing) will now show up in Studio system trace viewer, and nest under the correct process in Perfetto. ( I6b2e7 , b/293510459 )
- Removed macrobenchmark NOT-PROFILEABLE error on API 31+, and skip profileable check on eng/userdebug rooted devices. ( I2abac , b/291722507 )
- When using Dex Layout Optimizations, startup profile rules are also now considered as baseline profile rules. ( aosp/2684246 , b/293889189 )
Version 1.2.0-beta02
۲۶ ژوئیه ۲۰۲۳
androidx.benchmark:benchmark-*:1.2.0-beta02 is released. Version 1.2.0-beta02 contains these commits.
API Changes
- Added experimental APIs for microbench custom metrics and configuration (eg profiler, and tracing). ( I86101 , b/291820856 )
رفع اشکالات
- Report error in macrobench when OS is misconfigured for tracing, as was recently fixed in API 26/28 ARM64 emulators. ( I0a328 , b/282191686 )
- Added detail to compilation reset failure to suggest updating emulator, as some emulators have recently fixed this issue. ( I8c815 , b/282191686 )
- Make
androidx.test.uiautomator:uiautomator:2.2.0anapiinstead of animplementationdependency. ( I1981e )
Version 1.2.0-beta01
۱۸ ژوئیه ۲۰۲۳
androidx.benchmark:benchmark-*:1.2.0-beta01 is released. Version 1.2.0-beta01 contains these commits.
رفع اشکالات
- Fix warnings being sometimes suppressed in Benchmark output in Studio, and workaround leading whitespaces from Benchmark output not showing up in Studio ( Ia61d0 , b/227205461 , b/286306579 , b/285912360 )
- Fixed comment for
FrameTimingMetric. The submetric is namedframeDurationCpuMs. ( Ib097f , b/288830934 ).
Version 1.2.0-alpha16
۲۱ ژوئن ۲۰۲۳
androidx.benchmark:benchmark-*:1.2.0-alpha16 is released. Version 1.2.0-alpha16 contains these commits.
API Changes
-
BaselineProfileRule.collectBaselineProfile()API has been renamed toBaselineProfileRule.collect(). ( I4b665 )
رفع اشکالات
- Macrobenchmark support for
androidx.benchmark.profiling.mode = MethodTracing. ( I7ad37 , b/285912360 ) - Microbenchmark profiling moved to a separate phase, so it occurs in sequence after measurement, instead of replacing it.
MethodTracingtrace sections are also now included in the captured Perfetto trace, if present. ( I9f657 , b/285014599 ) - Add count measurement to
TraceSectionMetricwithMode.Sum. ( Ic121a , b/264398606 )
Version 1.2.0-alpha15
۷ ژوئن ۲۰۲۳
androidx.benchmark:benchmark-*:1.2.0-alpha15 is released. Version 1.2.0-alpha15 contains these commits.
ویژگیهای جدید
- Added experimental
MemoryUsageMetricfor tracking memory usage of a target application. ( I56453 , b/133147125 , b/281749311 ) - Add support for fully custom Perfetto configs with
PerfettoTrace.record( If9d75 , b/280460183 ) - Added property to skip baseline profile generation. Usage:
./gradlew assemble -Pandroidx.baselineprofile.skipgeneration. ( I37fda , b/283447020 )
API Changes
- The
collectBaselineProfileAPI always generates stable baseline profiles. ThecollectStableBaselineProfileAPI has been removed andcollectBaselineProfileshould be used instead. ( I17262 , b/281078707 ) - Changed
BaselineProfileRule'sfilterPredicatearg to non-null, with a equivalent default value so that the default filter behavior is more clear in docs. ( I3816e )
رفع اشکالات
- Disable
IsolationActivityand Perfetto tracing indryRunModeto significantly improve performance, as these were majority of runtime. ( Ie4f7d ) - Support for call stack sampling in Macrobenchmarks using instrumentation test arguments
androidx.benchmark.profiling.mode=StackSamplingandandroidx.benchmark.profiling.sampleFrequency. ( I1d13b , b/282188489 ) - Fixes crash when dropping shaders on Android U (API 34), as well as on emulators. ( I031ca , b/274314544 )
Version 1.2.0-alpha14
۳ مه ۲۰۲۳
androidx.benchmark:benchmark-*:1.2.0-alpha14 is released. Version 1.2.0-alpha14 contains these commits.
رفع اشکالات
- Fix
FrameTimingMetricignoring frames with inconsistent frame IDs. This would cause some animations on recent platform versions (API 31+) to ignore many frames whileRenderThreadwas animating (eg during a ripple). ( I747d2 , b/279088460 ) - Fixed trace processor parsing for traces larger than 64Mb. ( Ief831 , b/269949822 )
- Fixed baseline profile generation on Android U failing because of the different output of
pm dump-profilescommand. ( Id1392 , b/277645214 ) - Fix GPU clock locking script to compare strings correctly ( I53e54 , b/213935715 )
Version 1.2.0-alpha13
۵ آوریل ۲۰۲۳
androidx.benchmark:benchmark-*:1.2.0-alpha13 is released. Version 1.2.0-alpha13 contains these commits.
API Changes
- Added profile type parameter when generating baseline profiles to support upcoming startup profile feature ( Ie20d7 , b/275093123 )
- Added new experimental
TraceMetricAPI for defining fully custom metrics based on content of a Perfetto trace. ( I4ce31 , b/219851406 ) - Add an experimental metric to determine the number of page faults during a benchmark. ( I48db0 )
Version 1.2.0-alpha12
۲۲ مارس ۲۰۲۳
androidx.benchmark:benchmark-*:1.2.0-alpha12 is released. Version 1.2.0-alpha12 contains these commits.
ویژگیهای جدید
- The new baseline profile gradle plugin is released in alpha version, making it easier to generate a baseline profile and simplifying the developer workflow.
API Changes
- Removed Perfetto tracing support on API 21 and 22, which includes both Microbenchmarks and the experimental
PerfettoTraceAPIs. Prior to this version,UiAutomationconnections were unreliable on some devices. ( I78e8c ) - Added public experimental API for
PerfettoTraceProcessorto enable parsing trace content. This is a step toward fully custom metrics based on Perfetto trace data. ( I2659e , b/219851406 )
Version 1.2.0-alpha11
۸ مارس ۲۰۲۳
androidx.benchmark:benchmark-*:1.2.0-alpha11 is released. Version 1.2.0-alpha11 contains these commits.
رفع اشکالات
- Fixed crashes in
MacrobenchmarkRuleandBaselineProfileRulewhen reinstalling or extracting profiles from an app bundle with multiple APKs. ( I0d8c8 , b/270587281 )
Version 1.2.0-alpha10
۲۲ فوریه ۲۰۲۳
androidx.benchmark:benchmark-*:1.2.0-alpha10 is released. Version 1.2.0-alpha10 contains these commits.
ویژگیهای جدید
- On Android 14+, Macrobenchmark no longer reinstalls target applications to reset compilation state, thanks to a new platform feature. Previously it was necessary to have a rooted device, or to deal with all application state (eg user login) being removed before each benchmark runs. ( I9b08c , b/249143766 )
رفع اشکالات
- Fix
DryRunModeto no longer crash with empty profile, due to compilation skipping. Instead, it runs a single iteration and extracts the profile to ensure something is captured. ( I2f05d , b/266403227 ) - Fix
PowerMetriccrash when checking for powerstats presence on old API levels. ( 5faaf9 , b/268253898 )
Version 1.2.0-alpha09
۱۱ ژانویه ۲۰۲۳
androidx.benchmark:benchmark-*:1.2.0-alpha09 is released. Version 1.2.0-alpha09 contains these commits.
رفع اشکالات
- Enabled passing
Nonetoandroidx.benchmark.enabledRulesinstrumentation arg to disable all benchmarks / baseline profile generation. ( I3d7fd , b/258671856 ) - Fix
PerfettoTracecapture in app modules (ie non-self-instrumenting test APKs) ( I12cfc ) - Fixed baseline profile adb pull argument order in Studio output ( I958d1 , b/261781624 )
- Arm emulator api 33 is now correctly recognized as such when trying to run a macrobenchmark and will correctly print the warning. ( 69133b , b/262209591 )
- Skip battery level check on devices without battery in Macrobenchmark ( fe4114 , b/232448937 )
Version 1.2.0-alpha08
۷ دسامبر ۲۰۲۲
androidx.benchmark:benchmark-*:1.2.0-alpha08 is released. Version 1.2.0-alpha08 contains these commits.
API Changes
- Added experimental new APIs
PerfettoTrace.record {}andPerfettoTraceRuleto capture Perfetto traces (also known as System Traces) as part of a test, to inspect test behavior and performance. ( I3ba16 ) -
BaselineProfileRulenow accepts a filter predicate instead of a list of package prefixes. This gives the test full control on filtering. ( I93240 ) - Add an experimental API
BaselineProfileRule.collectStableBaselineProfilewhich waits until a baseline profile is stable for N iterations. ( I923f3 ) - Add the ability to specify an output file name prefix when generating baseline profiles using
BaselineProfileRule. ( I7b59f , b/260318655 )
رفع اشکالات
- Improve safety of file output writing, which should prevent output files from silently not being written / appended, especially on API 21/22. ( If8c44 , b/227510293 )
- Fix
simpleperftrace output to create and place the file correctly. This should also more generally fix issues where a file is unsuccessfully pulled by gradle. ( I12a1c , b/259424099 ) - Improve profileinstaller error message printed when profileinstaller is too old. This now tells you to update profileinstaller version (1.2.1) for measuring baseline profiles on API 31 through 33, instead of saying it's not supported. ( Ia517f , b/253519888 )
- Fix several shell command failures onerror message Print needed API <=23, including failed perfetto capture binary setup and trace capture failures ( Ib6b87 , b/258863685 )
- Automatically sort generated profile rules to minimize the number of changes as they change over time (when checking-in profile rules into source control). ( Ie2509 )
- Fixed crash on unrooted builds below Android 13 (API 33) with message
Expected no stderr from echo 3 > /proc/sys/vm/drop_caches( I6c245 , b/259508183 )
Known Issues - MacrobenchmarkScope.dropShaderCache() may crash due to a missing broadcast registry in profileinstaller manifest, which has not yet been released. ( I5c728 , b/258619948 ) To workaround the issue in profileinstaller:1.3.0-alpha02 , add the following to your application's (not your benchmark's) AndroidManifest.xml:
<!-- workaround bug in profileinstaller 1.3.0-alpha02, remove when updating to alpha03+ -->
<receiver
android:name="androidx.profileinstaller.ProfileInstallReceiver"
android:permission="android.permission.DUMP"
android:exported="true">
<intent-filter>
<action android:name="androidx.profileinstaller.action.BENCHMARK_OPERATION" />
</intent-filter>
</receiver>
Version 1.2.0-alpha07
۹ نوامبر ۲۰۲۲
androidx.benchmark:benchmark-*:1.2.0-alpha07 is released. Version 1.2.0-alpha07 contains these commits.
API Changes
- Adds
PowerMetricAPI for measuring energy and power in Macrobenchmarks. ( Ife601 , b/220183779 ) - Fixed
MacrobenchmarkScope.dropShaderCache()to actually drop the shader cache. This removes roughly 20ms of noise fromStartupMode.COLDbenchmarks, as shaders are now consistently cleared each iteration. Previously,Partialcompilation using warmup iterations would report incorrectly fast numbers, as shader caching was more likely to happen during warmup. This fix requires either a rooted device, or usingprofileinstaller:1.3.0-alpha02in the target app. ForProfileInstallerlibrary's API changes, please refer to ProfileInstaller 1.30-alpha02 page. ( Ia5171 , b/231455742 ) - Added
TraceSectionMode("label", Mode.Sum), allowing measurement of total time spent on multiple trace sections with the same label. For instance,TraceSectionMetric("inflate", Mode.Sum)will report a metricinflateMsfor the total time in a macrobenchmark spent on inflation. Also removed API 29 requirement, asTraceSectionMetricworks together withandroidx.tracing.Traceback to lower API levels, with the use offorceEnableAppTracingwithin the target app. ( Id7b68 , b/231455742 )
رفع اشکالات
- Improved safety of all internal shell commands by validating all output/errors. ( I5984d , b/255402908 , b/253094958 )
- Specify device in baseline profile
adb pullcommand, so the pull command can be simply copied if multiple devices are connected (up to one emulator) ( I6ac6c , b/223359380 ) - Add error if macrobenchmark test apk isn't set up as self-instrumenting. This error prevents macrobenchmarking from within the target app's process. In process, macrobench wouldn't be able to compile/kill/cold start the app, or control its own permissions ( I4279b )
- Fixed an issue in
measureRepeated()whereStartupMode.COLDwouldn't kill the target process aftersetupBlock. NowsetupBlockinteracting with the app will not leave the app process running, and an invalid cold start measurement. ( I8ebb7 )
Version 1.2.0-alpha06
۲۴ اکتبر ۲۰۲۲
androidx.benchmark:benchmark-*:1.2.0-alpha06 is released. Version 1.2.0-alpha06 contains these commits.
API Changes
-
BaselineProfileRuleno longer requires root on Android 13 (API 33), and is no longer experimental. ( Ie0a7d , b/250083467 , b/253094958 )- This change also fixes how profiles from an app are flushed to disk on unrooted devices, but requires updating the target app's profileinstaller dependency.
- To use
BaselineProfileRuleorCompilationMode.Partial(warmupIterations)on an unrooted device, you must also update your target app to useandroidx.profileinstaller.profileinstaller:1.3.0-alpha01. This enables flushing the profile to disk correctly, so that it can be compiled/extracted.
رفع اشکالات
- Fixes
SampledProfilingcrash on API 33+. ( I40743 , b/236109374 )
Version 1.2.0-alpha05
۵ اکتبر ۲۰۲۲
androidx.benchmark:benchmark-*:1.2.0-alpha05 is released. Version 1.2.0-alpha05 contains these commits.
رفع اشکالات
- Fix frame breakdown in Studio system trace viewer for benchmark captured traces ( I3f3ae , b/239677443 )
- Correct
FrameTimingMetricto listFrameOverrunas requiring API 31 instead of 29 ( I716dd , b/220702554 ) - Set iteration in
BaselineProfileRule, and throw clearly if target package not installed (was already done for MacrobenchmarkRule). ( Ic09a3 , b/227991471 )
Version 1.2.0-alpha04
September 21, 2022
androidx.benchmark:benchmark-*:1.2.0-alpha04 is released. Version 1.2.0-alpha04 contains these commits.
ویژگیهای جدید
Add support for
dryRunMode.enableinstrumentation argument to macrobenchmark (already available in micro) for faster local development, and validating app automation (eg in presubmit). This overrides iterations to 1, skips compilation, suppresses all configuration errors , and disables measurement .json file output. ( Ib51b4 , b/175149857 )On Gradle command line:
./gradlew macrobenchmark:cC -P android.testInstrumentationRunnerArguments.androidx.benchmark.dryRunMode.enable=trueIn build.gradle:
android { defaultConfig { testInstrumentationRunnerArgument 'androidx.benchmark.dryRunMode.enable', 'true' } }
رفع اشکالات
- Fixed
StartupTimingMetricto no longer require measured Activities to be launched throughMacrobenchmarkScope.startActivityAndWait(). This means the metric can pick up launches from eg notifications,Context.startActivity(), in-app Activity based navigation, or shell commands. ( Ia2de6 , b/245414235 ) - Fix bug where
startActivityAndWaitwould timeout trying to wait for launch completion on emulators by reducing strictness of frame detection. ( Ibe2c6 , b/244594339 , b/228946895 )
Version 1.2.0-alpha03
۷ سپتامبر ۲۰۲۲
androidx.benchmark:benchmark-*:1.2.0-alpha03 is released. Version 1.2.0-alpha03 contains these commits.
ویژگیهای جدید
- Added experimental APIs for using
BenchmarkStateindependently, separate fromBenchmarkRule/JUnit4. ( Id478f , b/228489614 )
رفع اشکالات
- Added Leanback fallback for
startActivityAndWait. ( 01ed77 , b/242899915 )
Version 1.2.0-alpha02
۲۴ آگوست ۲۰۲۲
androidx.benchmark:benchmark-*:1.2.0-alpha02 is released. Version 1.2.0-alpha02 contains these commits.
API Changes
- Default to
am force stopforMacrobenchmarkScope.killProcess(), even when rooted, except during Baseline Profile generation. This can be overridden with an optional boolean argument. ( 02cce9 , b/241214097 )
رفع اشکالات
- Support baseline profile generation for System apps. ( I900b8 , b/241214097 )
- Support checking for ODPM power metrics on unrooted devices. ( a38c78 , b/229623230 )
Version 1.2.0-alpha01
۲۷ ژوئیه ۲۰۲۲
androidx.benchmark:benchmark-*:1.2.0-alpha01 is released. Version 1.2.0-alpha01 contains these commits.
ویژگیهای جدید
- New tracing-perfetto-common component allowing tooling to enable Perfetto SDK tracing in an app that exposes it ( I2cc7f )
Added
androidx.benchmark.enabledRulesinstrumentation argument to enable filtering macrobenchmark runs to just benchmarks, or just baseline profile generation. Pass in 'Macrobenchmark', or 'BaselineProfile' to just run one type of test, eg when just generatingBaselineProfileson an emulator. Comma-separated list also Supported. ( I756b7 , b/230371561 )Eg in Your macrobenchmark's build.gradle:
android { defaultConfig { testInstrumentationRunnerArgument 'androidx.benchmark.enabledRules', 'BaselineProfile' } }Or from the Gradle command line:
./gradlew macrobenchmark:cC -P android.testInstrumentationRunnerArguments.androidx.benchmark.enabledRules=BaselineProfile
API Changes
- Added new
PowerMetricfor measuring energy and power tasks in benchmarks. ( I9f39b , b/220183779 ) - Added a new compilation mode
CompilationMode.Ignoreto skip profile reset and compilation. ( Ibbcf8 , b/230453509 ) - Added a new parameter to
BaselineProfileRule#collectBaselineProfileto filter output file by package names ( If7338 , b/220146561 ) - Enables developer to discharge device to measure power drain. ( I6a6cb )
- Added the ability to clear shader cache in
MacrobenchmarkScope. ( I32122 ) - Enables developer to configure display of metric type and detail desired subsystem categories. ( I810c9 )
- Previously an
UnsupportedOperationExceptionwas thrown in the benchmark if run on an unsupported device. Now UOE only occurs if the metric is used on the unsupported device (ie:PowerMetric.configure). ( I5cf20 , b/227229375 ) - Added
TotalPowerMetricandTotalEnergyMetricfor measuring total power and energy in each system category in macrobenchmarks. ( I3b26b , b/224557371 )
رفع اشکالات
- Fixed an issue where compiled methods were not correctly being reset between each macrobenchmark on unrooted builds. This unfortunately requires reinstalling the apk each iteration, which will clear application data for each macrobenchmark. ( I31c74 , b/230665435 )
- Fix trace recording crash on API 21/22 ( If7fd6 , b/227509388 , b/227510293 , b/227512788 )
- Overhaul activity launch completion detection to fix 'Unable to read any metrics' exception in startup macrobenchmarks. ( Ia517c )
نسخه ۱.۱.۱
نسخه ۱.۱.۱
۹ نوامبر ۲۰۲۲
androidx.benchmark:benchmark-*:1.1.1 is released. Version 1.1.1 contains these commits.
رفع اشکالات
- Fixes
android.system.ErrnoException: open failed: EACCESwhich would occur on some Android11 (API 30)+ devices. This is a cherry-pick of a fix from1.2.0-alpha01. ( aosp/2072249 )
Version 1.1.0
Version 1.1.0
۱۵ ژوئن ۲۰۲۲
androidx.benchmark:benchmark-*:1.1.0 is released. Version 1.1.0 contains these commits.
- This version is identical to
androidx.benchmark:benchmark-*:1.1.0-rc03.
Important changes since 1.0.0
Support for Jetpack Macrobenchmarks, which allows you to measure whole-app interactions like startup and scrolling , provides the ability to capture traces & measure trace sections .
Support for Baseline Profiles
-
CompilationMode.Partialto measure the effectiveness of Baseline Profiles. -
@BaselineProfileRuleto automatically generate Baseline profiles for a given critical user journey.
-
Support for Allocation metrics & profiling during Microbenchmark runs.
Version 1.1.0-rc03
۱ ژوئن ۲۰۲۲
androidx.benchmark:benchmark-*:1.1.0-rc03 is released. Version 1.1.0-rc03 contains these commits.
رفع اشکالات
Avoid reinstalling the target package on every benchmark iteration. ( aosp/2093027 , b/231976084 )
Remove the
300msdelay frompressHome(). ( aosp/2086030 , b/231322975 )Improve Macrobenchmark iteration speed by optimizing Shell commands used under the hood. ( aosp/2086023 , b/231323582 )
Support for Managed Gradle Devices when generating Baseline Profiles with Macrobenchmarks. ( aosp/2062228 , b/228926421 )
Version 1.1.0-rc02
۱۱ مه ۲۰۲۲
androidx.benchmark:benchmark-*:1.1.0-rc02 is released. Version 1.1.0-rc02 contains these commits.
- Note that this release includes a behavior change, as apps are now fully reinstalled in between each benchmark to ensure accurate measurements.
Bug Fixes/Behavior Changes
Fixed an issue where app compilation was not correctly reset between macrobenchmarks, and not reset at all on unrooted builds. This fixes many cases where running multiple tests would result in
CompilationModehaving little to no effect on measurements. To workaround this problem, the target app is now fully reinstalling each test method, which will clear application data between each macrobenchmark. ( I31c74 , b/230665435 )As this prevents apps from setting up state before tests, it is now possible to skip compilation / reinstallation to enable working around this. You can for example fully compile the target with a shell command
cmd package compile -f -m speed <package>, and then bypass macrobenchmark's compilation step.Eg in Your macrobenchmark's build.gradle:
android { defaultConfig { testInstrumentationRunnerArgument 'androidx.benchmark.compilation.enabled, 'false' } }Or from the Gradle command line:
./gradlew macrobenchmark:cC -P android.testInstrumentationRunnerArguments.androidx.benchmark.compilation.enabled=falseMade it possible to share a module between macrobenchmarks and baseline profile generating tests by adding
androidx.benchmark.enabledRulesinstrumentation argument. Pass in 'Macrobenchmark', or 'BaselineProfile' to just run one type of test, eg when generatingBaselineProfileson an emulator. ( I756b7 , b/230371561 )Eg in Your macrobenchmark's build.gradle:
android { defaultConfig { testInstrumentationRunnerArgument 'androidx.benchmark.enabledRules', 'BaselineProfile' } }Or from the Gradle command line:
./gradlew macrobenchmark:cC -P android.testInstrumentationRunnerArguments.androidx.benchmark.enabledRules=BaselineProfile
Version 1.1.0-rc01
۲۰ آوریل ۲۰۲۲
androidx.benchmark:benchmark-*:1.1.0-rc01 is released. Version 1.1.0-rc01 contains these commits.
رفع اشکالات
- Baseline profile output links in Android Studio now use a unique file name. This way the output always reflects the latest results of using a
BaselineProfileRule. ( aosp/2057008 , b/228203086 )
Version 1.1.0-beta06
۶ آوریل ۲۰۲۲
androidx.benchmark:benchmark-*:1.1.0-beta06 is released. Version 1.1.0-beta06 contains these commits.
رفع اشکالات
- Fix trace recording crash on API 21/22 ( If7fd6 , b/227509388 )
- Overhaul activity launch completion detection to fix 'Unable to read any metrics' exception in startup macrobenchmarks. ( Ia517c )
- Fix startup metrics for Macrobenchmarks when
CompilationMode.None()is used. Before this change,CompilationMode.Partial()would appear to be slower thanCompilation.None(). ( 611ac9 ).
Version 1.1.0-beta05
۲۳ مارس ۲۰۲۲
androidx.benchmark:benchmark-*:1.1.0-beta05 is released. Version 1.1.0-beta05 contains these commits.
رفع اشکالات
- Kill package after skipping profile installation when using
CompilationMode.None. ( aosp/1991373 ) - Fixed an issue where Macrobenchmarks is unable to collect startup metrics when using
StartupMode.COLD. ( aosp/2012227 b/218668335 )
Version 1.1.0-beta04
۲۳ فوریه ۲۰۲۲
androidx.benchmark:benchmark-*:1.1.0-beta04 is released. Version 1.1.0-beta04 contains these commits.
رفع اشکالات
Fix missing metrics on Android 10, and
NoSuchElementExceptioncaused by process names not being captured correctly in traces. ( Ib4c17 , b/218668335 )Use
PowerManagerfor thermal throttling detection on Q (API 29) and higher. This significantly reduces frequency of false positives in thermal throttling detection (benchmark retry after 90 second cooldown), and speeds up benchmarks significantly on user builds. It also provides throttle detection even when clocks are locked (if they're locked too high for the device's physical environment). ( I9c027 , b/217497678 , b/131755853 )Filter simpleperf sampled profiling to
measureRepeatedthread only to simplify inspection ( Ic3e12 , b/217501939 )Support metrics from named UI subprocesses in multi-process apps ( Ice6c0 , b/215988434 )
Filter Baseline Profile rules to target Android 9 (SDK 28). aosp/1980331 b/216508418
Skip Profile Installation when using
Compilation.None(). Additionally, report warnings when the app is using an older version ofandroidx.profileinstallerand Android Gradle Plugin. aosp/1977029
Version 1.1.0-beta03
۹ فوریه ۲۰۲۲
androidx.benchmark:benchmark-*:1.1.0-beta03 is released. Version 1.1.0-beta03 contains these commits.
API Changes
- Added
AudioUnderrunMetricinto macrobenchmark library under experimental flag to allow detection of audio underruns ( Ib5972 ) BaselineProfileRuleno longer accepts asetupblock as this functioned the same as theprofileBlock. ( Ic7dfe , b/215536447 )For eg
@Test fun collectBaselineProfile() { baselineRule.collectBaselineProfile( packageName = PACKAGE_NAME, setupBlock = { startActivityAndWait() }, profileBlock = { // ... } ) }@Test fun collectBaselineProfile() { baselineRule.collectBaselineProfile( packageName = PACKAGE_NAME, profileBlock = { startActivityAndWait() // ... } ) }
رفع اشکالات
- Fixed issue where microbench profiler traces would fail to be updated in subsequent runs when linked in Studio output ( I5ae4d , b/214917025 )
- Prevent compilation shell commands on API 23 ( Ice380 )
- Renamed
FrameCpuTime->FrameDurationCpu,FrameUiTime->FrameDurationUito clarify these are durations, not timestamps, and to match prefixes. ( I0eba3 , b/216337830 )
Version 1.1.0-beta02
۲۶ ژانویه ۲۰۲۲
androidx.benchmark:benchmark-*:1.1.0-beta02 is released. Version 1.1.0-beta02 contains these commits.
رفع اشکالات
- Microbenchmark Stack Sampling / Method Tracing Profile results are now linked in Studio output, similar to other profiling outputs, and do not suppress the allocation metric. ( Idcb65 , b/214440748 , b/214253245 )
- BaselineProfileRule now prints the
adb pullcommand in logcat and Studio output for pulling generated BaselineProfile text file. ( f08811 )
Version 1.1.0-beta01
۱۲ ژانویه ۲۰۲۲
androidx.benchmark:benchmark-*:1.1.0-beta01 is released. Version 1.1.0-beta01 contains these commits.
رفع اشکالات
- Fixes profiler argument enable being ignored. ( I37373 , b/210619998 )
- Removed deprecated
CompliationModes( I98186 , b/213467659 ) - Switched baseline profile arg of
CompilationMode.Partialto enum for clarity. ( Id67ea )
Version 1.1.0-alpha13
۱۵ دسامبر ۲۰۲۱
androidx.benchmark:benchmark-*:1.1.0-alpha13 is released. Version 1.1.0-alpha13 contains these commits.
API Changes
- Add low-overhead System Tracing to microbench output on Android Q (API 29+). Note that this does not currently capture custom tracing (via
android.os.Traceorandroidx.tracingJetpack APIs) to avoid affecting results. This tracing should be useful in diagnosing instability, especially from sources outside the benchmark. ( I298be , b/205636583 , b/145598917 ) - Clarify
CompilationModesinto three classes - Full, None, Partial. Previously they were inconsistently named after compilation arguments (which we now treat as implementation details) and features. This makes the tradeoffs, potential combinations, and behavior across platform versions more clear. ( I3d7bf , b/207132597 ) - Setup and measure are now always in pairs, in order. You can now query the package name and iteration (though the iteration may be
nullin certain warmup scenarios). ( Id3b68 , b/208357448 , b/208369635 )
رفع اشکالات
- Fixed
CompilationMode.Speedincorrectly treated asNone( I01137 )
Version 1.1.0-alpha12
۱۷ نوامبر ۲۰۲۱
androidx.benchmark:benchmark-*:1.1.0-alpha12 is released. Version 1.1.0-alpha12 contains these commits.
ویژگیهای جدید
- Add experimental TraceSectionMetric for custom trace-based timing measurements. ( I99db1 , b/204572664 )
رفع اشکالات
- Wake device each iteration, to ensure UI can be tested - requires lockscreen is disabled. ( Ibfa28 , b/180963442 )
- Fixes multiple crashes in StackSampling profiling mode on emulators and non-rooted devices ( Icdbda , b/202719335 )
- Removed 0.5 second sleep at the end of each iteration - if you see missing metrics with this change, please file a bug. ( Iff6aa )
- Reduce chances of dropped data, and lower memory overhead from tracing ( Id2544 , b/199324831 , b/204448861 )
- Reduce trace size by ~40% by switching to compact sched storage format. ( Id5fb6 , b/199324831 )
- Updated implementations of startup metrics to always end at end of renderthread. This will be more contistent across platform versions, and more closely map to in-app measurements. ( Ic6b55 )
Version 1.1.0-alpha11
۳ نوامبر ۲۰۲۱
androidx.benchmark:benchmark-*:1.1.0-alpha11 is released. Version 1.1.0-alpha11 contains these commits.
API Changes
- Macrobenchmark now has a
minSdkVersionof23. ( If2655 ) - Adds a new experimental
BaselineProfileRulewhich is capable of generating baseline profiles for app's critical user journey. Detailed documentation to follow. ( Ibbefa , b/203692160 ) - Removes measureRepeated interface variant, which was added for java callers, as it caused ambiguity in completing/resolving the method. Java callers will again need to return Unit.Instance from measureRepeated. If this is an inconvenience, please file a bug, we can revisit this in a future version. ( Ifb23e , b/204331495 )
Version 1.1.0-alpha10
۲۷ اکتبر ۲۰۲۱
androidx.benchmark:benchmark-*:1.1.0-alpha10 is released. Version 1.1.0-alpha10 contains these commits.
API Changes
- Backport StartupTimingMetric to work back to API 23. This new implementation also better handles reportFullyDrawn() to wait until corresponding content has been rendered. ( If3ac9 , b/183129298 )
- Added JvmOverloads to multiple MacrobenchmarkScope methods for Java callers. ( I644fe , b/184546459 )
- Provide alternative MacrobenchmarkRule.measureRepeated function that uses a
Consumer<MacrobenchmarkScope>for idiomatic usage in Java language. ( If74ab , b/184546459 )
رفع اشکالات
- Fix for traces not starting early enough, and missing metric data. This is expected to fix "Unable to read any metrics during benchmark" exceptions that were caused by the library itself. ( I6dfcb , b/193827052 , b/200302931 )
- FrameNegativeSlack has been renamed to FrameOverrun to clarify its meaning - how much the frame went over its time budget. ( I6c2aa , b/203008701 )
Version 1.1.0-alpha09
۱۳ اکتبر ۲۰۲۱
androidx.benchmark:benchmark-*:1.1.0-alpha09 is released. Version 1.1.0-alpha09 contains these commits.
رفع اشکالات
- Support dropping Kernel page cache without root on API 31/S+, which will increase accuracy of StartupMode.COLD launches. ( Iecfdb , b/200160030 )
Version 1.1.0-alpha08
۲۹ سپتامبر ۲۰۲۱
androidx.benchmark:benchmark-*:1.1.0-alpha08 is released. Version 1.1.0-alpha08 contains these commits.
API Changes
- Enable scrolling macrobenchmarks to run back to API 23 ( If39c2 , b/183129298 )
- Add new type of sampled metric to UI and JSON output, focused on percentiles of multiple samples per iteration. ( I56247 , b/199940612 )
- Switch to floating point metrics throughout the benchmark libraries (truncated in the Studio UI). ( I69249 , b/197008210 )
Version 1.1.0-alpha07
۱ سپتامبر ۲۰۲۱
androidx.benchmark:benchmark-*:1.1.0-alpha07 is released. Version 1.1.0-alpha07 contains these commits.
API Changes
- Raised min API to 21 to reflect the intended lowest API level to be supported in the future. Current min API supported continues to be conveyed via RequiredApi(), and is currently 29 ( I440d6 , b/183129298 )
رفع اشکالات
- Fixes
ProfileInstallerto make it easier for apps using baseline profiles to run MacroBenchmarks usingCompilationMode.BaselineProfile. ( I42657 , b/196074999 ) NOTE: requires also updating toandroidx.profileinstaller:profileinstaller:1.1.0-alpha04or greater. -
StartupMode.COLD+CompilationMode.Nonebenchmarks are now more stable. ( I770cd , b/196074999 )
Version 1.1.0-alpha06
۱۸ آگوست ۲۰۲۱
androidx.benchmark:benchmark-*:1.1.0-alpha06 is released. Version 1.1.0-alpha06 contains these commits.
API Changes
- Added
androidx.benchmark.iterationsinstrumentation argument to allow manual overriding of iteration count when testing/profiling locally. ( 6188be , b/194137879 )
رفع اشکالات
- Switched to Simpleperf as default sampling profiler on API 29+. ( Ic4b34 , b/158303822 )
مشکلات شناخته شده
-
CompilationMode.BaselineProfileis a work in progress. Avoid using it to determine how good a profile is for now.
Version 1.1.0-alpha05
۴ آگوست ۲۰۲۱
androidx.benchmark:benchmark-*:1.1.0-alpha05 is released. Version 1.1.0-alpha05 contains these commits.
1.1.0-alpha04 was cancelled before release due to a sporatic crash. b/193827052
API Changes
- Switched startActivityAndWait to invoke launch via
am start, which reduces the time of each measurement iteration by approximately 5 seconds, at the cost of no longer supporting intent parcelables. ( I5a6f5 , b/192009149
رفع اشکالات
- Reduce aggressiveness of thermal throttle detection, and recompute baseline if throttles are detected frequently. ( I7327b )
- Fixes FrameTimingMetric to work on Android S beta ( Ib60cc , b/193260119 )
- Use an
EmptyActivityto bring the target app out of a force-stopped state to better supportCompilationMode.BaselineProfile. ( Id7cac , b/192084204 ) - Changed trace file extension to
.perfetto-traceto match platform standard. ( I4c236 , b/174663039 ) - StartupTimingMetric now outputs the "fullyDrawnMs" metric to measure time until your application has completed rendering. To define this metric for your app, call Activity.reportFullyDrawn when your initial content is ready, such as when your initial list items are loaded from DB or network. (reportFullyDrawn method available without build version checks on ComponentActivity). Note that your test must run long enough to capture the metric (startActivityAndWait doesn't wait for reportFullyDrawn). ( If1141 , b/179176560 )
- Reduce cost of appending Ui metadata to traces by 50+ ms ( Ic8390 , b/193923003 )
- Drastically increased polling frequency when stopping tracing, which can reduce eg startup benchmark runtime by 30+% ( Idfbc1 , b/193723768 )
Version 1.1.0-alpha03
۱۶ ژوئن ۲۰۲۱
androidx.benchmark:benchmark-*:1.1.0-alpha03 is released. Version 1.1.0-alpha03 contains these commits.
ویژگیهای جدید
- Added a new
CompilationMode.BaselineProfileto support profiles installed using the Jetpack ProfileInstaller library . ( aosp/1720930 )
رفع اشکالات
The sample Gradle code for suppressing benchmark errors has been updated to use a non-deprecated API with a syntax that also supports .gradle.kts users.
Eg,
testInstrumentationRunnerArguments["androidx.benchmark.suppressErrors"] = "EMULATOR,LOW-BATTERY"
Version 1.1.0-alpha02
May 18, 2021
Benchmark version 1.1.0-alpha02 brings a big component to benchmarking - Macrobenchmark. In addition to benchmark allowing you to measure CPU loops, macrobenchmark allows you to measure whole-app interactions like startup and scrolling, and capture traces. For more information see the library documentation .
androidx.benchmark:benchmark-*:1.1.0-alpha02 is released. Version 1.1.0-alpha02 contains these commits.
ویژگیهای جدید
Macrobenchmark artifacts added ( androidx.benchmark:benchmark-macro-junit4 and androidx.benchmark:benchmark-macro )
- Capture startup, scrolling/animation performance metrics from your app, locally or in CI
- Capture and inspect traces from within Android Studio
رفع اشکالات
- Workaround shell permissions issue with output directory on Android 12 (Note - may require updating Android Gradle Plugin to 7.0.0 canary and Android Studio to Arctic Fox (2020.3.1), to continue capturing output files on affected devices). ( Icb039 )
- Support configuration caching in BenchmarkPlugin ( 6be1c1 , b/159804788 )
- Simplified file output - on by default, in a directory that doesn't require
requestLegacyExternalStorage=true( 8b5a4d , b/172376362 ) - Fixes library printing logcat warnings about not finding JIT thread on platform versions where it is not present. ( I9cc63 , b/161847393 )
- Fix for reading device max frequency. ( I55c7a )
Version 1.1.0-alpha01
۱۰ ژوئن ۲۰۲۰
androidx.benchmark:benchmark-common:1.1.0-alpha01 , androidx.benchmark:benchmark-gradle-plugin:1.1.0-alpha01 , and androidx.benchmark:benchmark-junit4:1.1.0-alpha01 are released. Version 1.1.0-alpha01 contains these commits.
New Features of 1.1
- Allocation Metric - Benchmarks now run an additional phase after warmup and timing, capturing allocation counts. Allocations can cause performance problems on older versions of the platform (140ns in O became 8ns in M - measured on Nexus5X, with locked clocks). This metric is displayed in Android Studio console output, as well as in the
- Profiling support - You can now capture profiling data for a benchmark run, to inspect why your code may be running slowly. Benchmark supports capturing either method tracing, or method sampling from ART. These files can be inspected with the Profiler inside Android Studio using File > Open .
- The Benchmark Gradle plugin now provides defaults for simpler setup:
-
testBuildTypeis set to release by default, to avoid using dependencies with code coverage built-in. The release buildType is also configured as the default buildType, which allows Android Studio to automatically select the correct build variant when opening a project for the first time. ( b/138808399 ) -
signingConfig.debugis used as the default signing config ( b/153583269 )
-
** Bug Fixes **
- Significantly reduced the warmup transition overhead, where the first measurement for each benchmark was artificially higher than others. This issue was more pronounced in very small benchmarks (1 microsecond or less). ( b/142058671 )
- Fixed
InstrumentationResultParsererror printed for each benchmark when running from command line. ( I64988 , b/154248456 )
مشکلات شناخته شده
- Command line, gradle invocations of Benchmark do not print out results directly. You can work around this by either running through Studio, or parsing the JSON output file for results.
- Benchmark reporting fails to pull the report from devices that have an app installed with an applicationId ending with either “android” or “download” (case insensitive). Users hitting this issue should upgrade the Android Gradle Plugin to 4.2-alpha01 or later.
نسخه ۱.۰.۰
Benchmark Version 1.0.0
۲۰ نوامبر ۲۰۱۹
androidx.benchmark:benchmark-common:1.0.0 , androidx.benchmark:benchmark-gradle-plugin:1.0.0 , and androidx.benchmark:benchmark-junit4:1.0.0 are released with no changes from 1.0.0-rc01. Version 1.0.0 contains these commits .
Major features of 1.0.0
The Benchmark library allows you to write performance benchmarks of app code and get results quickly.
It prevents build and runtime configuration issues and stabilizes device performance to ensure that measurements are accurate and consistent. Run the benchmarks directly in Android Studio , or in Continuous Integration to observe code performance over time, and to prevent regressions.
ویژگیهای عمده عبارتند از:
- Clock stabilization
- Automatic thread prioritization
- Support for UI performance testing, such as in the RecyclerView Sample
- JIT-aware warmup and looping
- JSON benchmark output for post-processing
Version 1.0.0-rc01
۲۳ اکتبر ۲۰۱۹
androidx.benchmark:benchmark-common:1.0.0-rc01 , androidx.benchmark:benchmark-gradle-plugin:1.0.0-rc01 , and androidx.benchmark:benchmark-junit4:1.0.0-rc01 are released. Version 1.0.0-rc01 contains these commits .
ویژگیهای جدید
- Added systrace tracing to benchmarks
رفع اشکالات
- Fixed metric instability issue where JIT wouldn't finish before warm up due to deprioritization ( b/140773023 )
- Unified JSON output directory across Android Gradle Plugin 3.5 and 3.6
Version 1.0.0-beta01
۹ اکتبر ۲۰۱۹
androidx.benchmark:benchmark-common:1.0.0-beta01 , androidx.benchmark:benchmark-gradle-plugin:1.0.0-beta01 , and androidx.benchmark:benchmark-junit4:1.0.0-beta01 are released. Version 1.0.0-beta01 contains these commits .
ویژگیهای جدید
- Run garbage collection before each warmup to reduce memory pressure from one benchmark to leak to the next ( b/140895105 )
رفع اشکالات
- Added
androidx.annotation:android-experimental-lintdependency, so that Java code will correctly produce lint errors when experimental API is not used, similar to what is provided by the Kotlin experimental annotation for Kotlin callers. - Now correctly detects usage of
additionalTestOutputDirinstrumentation argument for output in Android Gradle Plugin 3.6, to know when AGP will handle data copy. - Fix undetected clock frequency in JSON to correctly print
-1( b/141945670 ).
Version 1.0.0-alpha06
۱۸ سپتامبر ۲۰۱۹
androidx.benchmark:benchmark-common:1.0.0-alpha06 , androidx.benchmark:benchmark-gradle-plugin:1.0.0-alpha06 , and androidx.benchmark:benchmark-junit4:1.0.0-alpha06 are released. Version 1.0.0-alpha06 contains these commits .
ویژگیهای جدید
- Added a check for incorrectly using the old package for the test runner, which now provides a more-helpful error message
API changes
- The experimental annotation
ExperimentalAnnotationReportis now correctly public. Usage of the experimental BenchmarkState#report API now requires this annotation
Version 1.0.0-alpha05
۵ سپتامبر ۲۰۱۹
androidx.benchmark:benchmark-common:1.0.0-alpha05 , androidx.benchmark:benchmark-gradle-plugin:1.0.0-alpha05 , and androidx.benchmark:benchmark-junit4:1.0.0-alpha05 are released. The commits included in this version can be found here .
API changes
-
BenchmarkState.reportDataAPI is now marked experimental
رفع اشکالات
- Fix for the clock-locking script, which would fail on devices that were either missing the
cutorexprshell utilities. - Fixed an issue with
./gradlew lockClockstask that would hang on devices that were rooted with an older version of the su utility, which did not support the-cflag.
Version 1.0.0-alpha04
۷ آگوست ۲۰۱۹
androidx.benchmark:benchmark-common:1.0.0-alpha04 , androidx.benchmark:benchmark-gradle-plugin:1.0.0-alpha04 , and androidx.benchmark:benchmark-junit4:1.0.0-alpha04 are released. The commits included in this version can be found here .
New documentation has also been added for how to use the Benchmark library without Gradle, both for usage with different build systems (such as Bazel or Buck), and when running in CI. For more information, see Build benchmarks without Gradle and Run benchmarks in Continuous Integration .
ویژگیهای جدید
- Gradle plugin
- Now automatically disables test coverage, and sets the
AndroidBenchmarkRunnerby default ( b/138374050 ) - Added support for new AGP-based data copy, when running benchmarks and when using AGP 3.6+
- Now automatically disables test coverage, and sets the
- JSON format additions
- Output total benchmark test run time ( b/133147694 )
-
@Parameterizedbenchmarks that use a name string (for example@Parameters(name = "size={0},depth={1}")) now output parameter names and values per benchmark in the JSON output ( b/132578772 )
- Dry Run mode ( b/138785848 )
- Added a "dry run" mode for running each benchmark loop only once, to check for errors/crashes without capturing measurements. This can be useful eg for, for example, quickly running benchmarks in presubmit to check that they're not broken.
API changes
- Module structure has changed, splitting the library ( b/138451391 )
-
benchmark:benchmark-junit4contains classes with JUnit dependency:AndroidBenchmarkRunner, andBenchmarkRule, both of which have moved into theandroidx.benchmark.junit4package -
benchmark:benchmark-commoncontains the rest of the logic, including the BenchmarkState API - This split will allow the library to support benchmarking without JUnit4 APIs in the future
-
- Configuration warnings are now treated as errors, and will crash the test ( b/137653596 )
- This is done to further encourage accurate measurements, especially in CI
- These errors can be reduced back to warnings with an instrumentation argument. For example:
-e androidx.benchmark.suppressErrors "DEBUGGABLE,LOW_BATTERY"
رفع اشکالات
- Errors when writing to external storage on Q devices provide more-descriptive messages, with suggestions of how to resolve the issue
- Screens are automatically turned on during benchmark runs, instead of failing when the screen is off
External contributions
- Thanks to Sergey Zakharov for contributing JSON output improvements and the fix for screen off issues!
Version 1.0.0-alpha03
۲ ژوئیه ۲۰۱۹
androidx.benchmark:benchmark:1.0.0-alpha03 and androidx.benchmark:benchmark-gradle-plugin:1.0.0-alpha03 are released. The commits included in this version can be found here .
ویژگیهای جدید
- Expose sleep duration due to thermal throttling per benchmark in the full JSON report
رفع اشکالات
- The Gradle plugin should no longer be required to be applied after Android plugins and the Android block
- Adds support for benchmark reports on Android 10 devices using scoped storage
Version 1.0.0-alpha02
۶ ژوئن ۲۰۱۹
androidx.benchmark:1.0.0-alpha02 and androidx.benchmark:benchmark-gradle-plugin:1.0.0-alpha02 are released. The commits included in this version can be found here .
Note that we are treating the JSON schema as an API. We plan to follow the same stability constraints as other APIs: stable (with very rare exceptions) once in beta, and fixed in final release, with only additions in minor releases and changes/removals in major releases.
API changes
Overhauled JSON schema. Further changes to the JSON schema are likely to be limited to additions:
- Reorganized the result object structure to support additional metric groups in the future ( b/132713021 )
- Added test run context information, such as device and build info and whether clocks are locked, to the top-level object ( b/132711920 )
- Time metric names now have 'ns' in their name ( b/132714527 )
- Additional stats added per reported metric (maximum, median, minimum), and removed simplified 'nanos' summary stat ( b/132713851 )
Removed XML output ( b/132714414 )
Thermal throttle detection removed from
BenchmarkState.reportDataAPI ( b/132887006 )
رفع اشکالات
- Fixed
./gradlew lockClocksnot sticking on some recent OS devices ( b/133424037 ) - Throttling detection disabled for emulator ( b/132880807 )
Version 1.0.0-alpha01
۷ مه ۲۰۱۹
androidx.benchmark:benchmark:1.0.0-alpha01 is released. The commits included in this version are available here .