معیار

عملکرد کد خود را به طور دقیق در Android Studio اندازه گیری کنید.
آخرین به روز رسانی انتشار پایدار کاندید را آزاد کنید نسخه بتا انتشار آلفا
9 آوریل 2025 1.3.4 - - 1.4.0-alpha11

اعلام وابستگی ها

برای افزودن وابستگی به بنچمارک، باید مخزن Google Maven را به پروژه خود اضافه کنید. برای اطلاعات بیشتر، مخزن Maven Google را بخوانید.

ماکرو بنچمارک

برای استفاده از Macrobenchmark در پروژه خود، وابستگی های زیر را به فایل build.gradle خود برای ماژول macrobenchmark خود اضافه کنید:

شیار

dependencies {
  androidTestImplementation "androidx.benchmark:benchmark-macro-junit4:1.3.4"
}

کاتلین

dependencies {
  androidTestImplementation("androidx.benchmark:benchmark-macro-junit4:1.3.4")
}

میکرو بنچمارک

برای استفاده از Microbenchmark در پروژه خود، وابستگی های زیر را برای ماژول microbenchmark خود به فایل build.gradle خود اضافه کنید:

شیار

dependencies {
    androidTestImplementation "androidx.benchmark:benchmark-junit4:1.3.4"
}

android {
    ...
    defaultConfig {
        ...
        testInstrumentationRunner "androidx.benchmark.junit4.AndroidBenchmarkRunner"
    }
}

کاتلین

dependencies {
    androidTestImplementation("androidx.benchmark:benchmark-junit4:1.3.4")
}

android {
    ...
    defaultConfig {
        ...
        testInstrumentationRunner = "androidx.benchmark.junit4.AndroidBenchmarkRunner"
    }
}

کتابخانه Microbenchmark همچنین یک پلاگین Gradle را برای استفاده با ماژول microbenchmark ارائه می دهد. این افزونه پیش‌فرض‌های پیکربندی ساخت را برای ماژول تنظیم می‌کند، نسخه خروجی معیار را برای میزبان تنظیم می‌کند و وظیفه ./gradlew lockClocks را ارائه می‌کند.

برای استفاده از این افزونه، خط زیر را در بلوک «plugins» در فایل build.gradle سطح بالای خود قرار دهید:

شیار

plugins {
  id 'androidx.benchmark' version '1.3.4' apply false
}

کاتلین

plugins {
  id("androidx.benchmark") version "1.3.4" apply false
}

سپس افزونه را در فایل build.gradle ماژول بنچمارک خود اعمال کنید

شیار

plugins {
  id 'androidx.benchmark'
}

کاتلین

plugins {
    id("androidx.benchmark")
}

بازخورد

بازخورد شما به بهتر شدن Jetpack کمک می کند. اگر مسائل جدیدی کشف کردید یا ایده هایی برای بهبود این کتابخانه دارید، به ما اطلاع دهید. لطفاً قبل از ایجاد کتابخانه جدید، به مسائل موجود در این کتابخانه نگاهی بیندازید. با کلیک کردن روی دکمه ستاره می توانید رای خود را به یک موضوع موجود اضافه کنید.

یک شماره جدید ایجاد کنید

برای اطلاعات بیشتر به مستندات ردیاب مشکل مراجعه کنید.

نسخه 1.4

نسخه 1.4.0-alpha11

9 آوریل 2025

androidx.benchmark:benchmark-*:1.4.0-alpha11 منتشر شد. نسخه 1.4.0-alpha11 حاوی این commit ها است.

تغییرات API

  • مهلت زمانی آرگومان TraceProcessor تغییر کرد: مدت زمان تا زمانی که Ms برای قابلیت استفاده تماس گیرنده جاوا طولانی است. ( I9fbb5 )
  • سازنده TraceProcessor به عنوان داخلی علامت گذاری کنید. تماس گیرندگان باید از TraceProcessor.startServer یا TraceProcessor.runServer استفاده کنند. ( Ia8c5b )

رفع اشکال

  • هنگام از بین بردن برنامه با MacrobenchmarkScope.killProcess ، نتایج فرمان kill را اعتبارسنجی کنید تا از شکست بی صدا و خطای مهلت زمانی جلوگیری کنید. ( I84555 )

به روز رسانی های وابستگی

  • این کتابخانه اکنون سطح زبان Kotlin 2.0 را هدف قرار می دهد و به KGP 2.0.0 یا جدیدتر نیاز دارد. ( Idb6b5 )

نسخه 1.4.0-alpha10

26 مارس 2025

androidx.benchmark:benchmark-*:1.4.0-alpha10 منتشر شد. نسخه 1.4.0-alpha10 حاوی این commit ها است.

تغییرات API

  • مدت زمان پیش‌فرض برای بارگیری سرور TraceProcessor و پرس‌وجو را به 120 ثانیه افزایش داد (از 60/30 قبلی)، و هر دو را با یک پارامتر زمان‌بندی قابل تنظیم کرد. ( Ifec87 )

رفع اشکال

  • برخی از مشکلاتی را که هنگام محک زدن یا گرفتن نمایه‌های یک برنامه بدون profileinstaller رخ می‌داد، برطرف کرد و BroadcastReciever نیز شامل می‌شود. این فقط بر روی دستگاه های روت شده تأثیر می گذارد. ( Ied308 )

نسخه 1.4.0-alpha09

12 مارس 2025

androidx.benchmark:benchmark-*:1.4.0-alpha09 منتشر شد. نسخه 1.4.0-alpha09 حاوی این تعهدات است.

تغییرات API

  • TraceProcessor و Session API با دستگیره های قابل بسته برای استفاده آسان تر با چرخه عمر سفارشی اضافه شده است. این همچنین گامی در جهت فعال کردن استفاده آسان‌تر از Coroutine و Java API است. توابع افزودنی TraceProcessor.runServer {} اکنون آزمایشی علامت‌گذاری شده‌اند، زیرا احتمالاً جابه‌جا می‌شوند و در آینده غیرآزمایشی می‌شوند. ( I358b4 )

رفع اشکال

  • به دلیل تغییر در جعبه اسباب‌بازی pgrep که اکنون برای چاپ خط فرمان کامل -a نیاز دارد، ضبط معیار و نمایه خط پایه ثابت با API 36 کار نمی‌کند. ( IDc991 )
  • تنظیمات ردیابی پیش‌فرض را فیلتر کنید تا خطر از دست رفتن داده‌ها در ردیابی‌ها در سطوح API جدیدتر کاهش یابد. ( I54e8a )
  • آرگومان ابزار دقیق androidx.benchmark.killExistingPerfettoRecordings آزمایشی اضافه شد، که می‌توان آن را روی false تنظیم کرد تا امکان ادامه گرفتن ردیابی perfetto از قبل وجود داشته باشد. به‌طور پیش‌فرض، ردیابی‌های پرفتو موجود روی دستگاه برای جلوگیری از تداخل، از بین می‌روند. ( I02a3c )
  • فیلد JSON context.osCodenameAbbreviated اکنون برای نسخه‌های سیستم‌عامل منتشر شده در API 35 و بالاتر از آن، REL خواهد بود، زیرا نام‌های کد غیر عددی دیگر توسط پلتفرم اصلی پشتیبانی نمی‌شوند. ( Ib17fd )
  • رفع خرابی در FrameTimingMetric هنگامی که فریم‌های همگام‌سازی مجدد انجام می‌شوند. ( I7c6f4 , b/394610806 )
  • دیگر تصور نکنید Choreographer#doFrame بالای قاب پشته در رشته اصلی FrameTimingQuery است. ( Iee0e0 , b/340206285 )

نسخه 1.4.0-alpha08

12 فوریه 2025

androidx.benchmark:benchmark-*:1.4.0-alpha08 منتشر شد. نسخه 1.4.0-alpha08 حاوی این commit ها است.

تغییرات API

  • APIهای برنامه افزودنی TraceProcessor.runSession() را به صورت آزمایشی منتقل کرد، زیرا احتمالاً در نهایت به سازنده‌های بتن در Android تبدیل می‌شوند. ( Ib0528 , b/393640753 )
  • بیشتر پیاده‌سازی Startup Insights اکنون عمومی/تجربی هستند و به مصنوع TraceProcessor مراجعه کنید StartupInsights . ( I0aa00 )
  • BenchmarkRule.runWithTimingDisabled {} را به نفع BenchmarkRule.runWithMeasurementDisabled {} منسوخ کنید، که به وضوح رفتار را توصیف می کند - همه معیارها متوقف می شوند. علاوه بر این، سوپرکلاس MicrobenchmarkScope در معرض دید قرار دهید، زیرا اعلام مجدد تابع runWithMeasurementDisabled برای دسترسی باز امکان پذیر نیست، زیرا درون خطی است. ( I9e23b , b/389149423 , b/149979716 )
  • کتابخانه های معیار به Kotlin 2.0 منتقل شده اند. ( I9d1e0 )
  • آرگومان ابزار دقیق androidx.benchmark.startupProfiles.enable حذف شد. این دیگر مفید نیست، زیرا می توان آن را با includeInStartupProfile arg در BaselineProfileRule.collect() کنترل کرد. ( I39eb4 )

رفع اشکال

  • کاهش تعداد توابع داخلی Microbenchmark که در حین نمایه‌سازی فراخوانی می‌شوند تا به عنوان مثال ردیابی‌های روش واضح‌تر شوند ( Ifaed8 )
  • راه حل احتمالی برای خرابی ها: 'توقف [ ProcessPid(processName=perfetto, pid=...) ] ناموفق بود. اکنون وقتی یک فرآیند Perfetto پس‌زمینه قبل از اجرای معیار متوقف نمی‌شود، بنچمارک به جای خراب شدن، پیامی را ثبت می‌کند. ( I37d3e , b/323601788 )
  • IllegalStateExceptions با برچسب 'stdout pm dump-profiles مورد انتظار' که به دلیل بررسی فرمت خروجی بسیار دقیق ایجاد شده اند، برطرف کنید. ( I358dc )

نسخه 1.4.0-alpha07

29 ژانویه 2025

androidx.benchmark:benchmark-*:1.4.0-alpha07 منتشر شد. نسخه 1.4.0-alpha07 حاوی این commit ها است.

ویژگی های جدید

  • BaselineProfileRule اکنون یک API collectWithResults(...) را معرفی می کند که شامل لیستی از مسیرهای پروفایل های محاسبه شده است. ( I056f8 )
  • آرگومان ابزار دقیق androidx.benchmark.measureRepeatedOnMainThread.throwOnDeadline اضافه شد، که می تواند روی false تنظیم شود تا رفتار مهلت measureRepeatedOnMainThread برای آزمایش محلی غیرفعال شود. در غیر این صورت توصیه نمی شود، زیرا این امر احتمال ANR را در طول آزمایشات افزایش می دهد. ( آیدبیک , b/353226476 )

تغییرات API

  • @JvmOverloads به سازنده MicrobenchmarkConfig اضافه شد. ( I13fd3 )
  • Refactored BenchmarkRule که در بالای کوروتین ها ساخته می شود و از رفتار yield() بهتر پشتیبانی می کند. این Refactor چندین API آزمایشی BenchmarkState را حذف کرد، اما در صورت نیاز جایگزین‌هایی خواهد شد. علاوه بر این، runWithMeasurementDisabled برای شفاف‌سازی رفتار اضافه کرد (تمام اندازه‌گیری‌ها متوقف می‌شوند). در آینده، runWithTimingDisabled منسوخ خواهد شد. ( I19837 , b/389149423 , b/311242861 )
  • PerfettoTraceProcessor در یک مصنوع جدید androidx.benchmark:benchmark-traceprocessor به TraceProcessor منتقل کنید و بیشتر API آن را غیر آزمایشی کنید. هر TraceMetric سفارشی یا هر چیزی که از ردیابی می‌خواند باید به واردات TraceProcessor جدید به‌روزرسانی شود. TraceProcessor API جدید دقیقاً مانند نسخه قدیمی کار می‌کند، اما یک کتابخانه رابط مستقل (تا حدودی مشابه لایه androidx.sqlite از Room) با پیاده‌سازی مختص اندروید در ماکرو بنچمارک است. مصنوع جدید را می توان در JVM نیز استفاده کرد، اما در حال حاضر باید کپی خود را از TraceProcessor باینری راه اندازی کنید و یک پورت برای اتصال به آن ارائه دهید. ( I3a767 , I62563 , b/381134564 )

رفع اشکال

  • هنگامی که MacrobenchmarkScope.startActivityAndWait نمی تواند فرآیند هدف را راه اندازی کند (احتمالاً به دلیل خرابی در فرآیند هدف)، به جای پیام مبهم تر "عدم تایید تکمیل راه اندازی فعالیت" ( I3539b ) یک پیام خطای واضح تر ارسال کنید.
  • چندین خطای نحوی در نمونه‌های کاتلین و برجسته‌سازی نحو در چندین نمونه جاوا / build.gradle رفع شد. ( IB3808 )
  • اسناد پارامتر ArtMetric و CaptureInfo روشن شد. ( I96e60 )

نسخه 1.4.0-alpha06

11 دسامبر 2024

androidx.benchmark:benchmark-*:1.4.0-alpha06 منتشر شد. نسخه 1.4.0-alpha06 حاوی این commit ها است.

تغییرات API

  • استفاده از @Language("sql") در PerfettoTraceProcessor.Session.query() حذف شد، زیرا برجسته کردن/تجزیه استودیو شکسته شده است. ( Idc2fa , b/377733398 )

رفع اشکال

  • این کتابخانه اکنون از حاشیه‌نویسی‌های پوچ JSpecify استفاده می‌کند که نوع استفاده هستند. توسعه دهندگان Kotlin باید از آرگومان های کامپایلر زیر برای اعمال استفاده صحیح استفاده کنند: -Xjspecify-annotations=strict ، -Xtype-enhancement-improvements-strict-mode ( I46810 , b/326456246 )
  • ArtMetric را تصحیح کرد تا بار کلاس را گزارش کند (نه init)، و اسناد بهبود یافته برای روشن کردن رفتار زمان اجرا. ( I9915c )
  • در Android Multiuser، دستورات را فقط به صورت روت در دستگاه های روت شده اجرا کنید. ( I88b44 )

نسخه 1.4.0-alpha05

13 نوامبر 2024

androidx.benchmark:benchmark-*:1.4.0-alpha05 منتشر شد. نسخه 1.4.0-alpha05 حاوی این تعهدات است.

رفع اشکال

  • مشکلی در API 34+ برطرف شد که در آن CompilationMode.None() عملکرد متناقضی داشت که نشان دهنده عملکرد اولیه و بدترین حالت نیست. این کار حول یک تغییر پلتفرم عمل می کند که به وضعیت کامپایل ART اجازه می دهد تا کمی پس از اولین راه اندازی برنامه ها را تا حدی verify کند (فقط بر بارگذاری کلاس تأثیر می گذارد). ( Ie48d0 )
  • به دلیل کوتاه شدن نام فرآیند در ردیابی Perfetto، مشکلی که در آن می‌توان ردیابی (مخصوصاً کوتاه) را گرفت که اندازه‌گیری را از معیارهای اندازه‌گیری Macrobenchmark داخلی گزارش نمی‌کرد، برطرف شد. اکنون macrobenchmark با جستجوی نام بسته کوتاه شده در تمام پرس و جوهای داخلی، علاوه بر نام بسته مورد انتظار، حول این مشکل کار می کند. توجه داشته باشید که پیاده‌سازی‌های سفارشی TraceMetric یا دیگر تماس‌گیرندگان مستقیم PerfettoSession.query می‌توانند همین رفتار را با تغییر process.name LIKE "$packageName" در یک جستار Perfetto به جای آن (process.name LIKE "$packageName" OR process.name LIKE "$(packageName.takeLast(15))") . ( I5bf01 , b/377565760 )

نسخه 1.4.0-alpha04

30 اکتبر 2024

androidx.benchmark:benchmark-*:1.4.0-alpha04 منتشر شد. نسخه 1.4.0-alpha04 حاوی این commit ها است.

ویژگی های جدید

  • (تجربی) تولید نمایه پایه و محک زدن را روی برنامه‌های نصب شده روی یک کاربر ثانویه فعال کنید، برای مثال هر برنامه‌ای در دستگاه‌های Android Auto بدون هد. این پشتیبانی در برخی از سناریوها آزمایش شده است، اما اگر برای شما کار نکرد، با یک اشکال به ما اطلاع دهید. ( I9fcbe , b/356684617 , b/373641155 )

رفع اشکال

  • isProfileable اکنون همیشه در ساخت‌های بنچمارک لغو می‌شود، و isDebuggable نیز اکنون همیشه در ساخت‌های بنچمارک و nonMinified (گرفتن نمایه خط پایه) لغو می‌شود. ( I487fa , b/369213505 )
  • تشخیص کامپایل را در برخی از دستگاه‌های فیزیکی قبل از API 28 برطرف می‌کند - بر روی json context.compilationMode و همچنین بر رفتار androidx.benchmark.requireAot=true (که دیگر به اشتباه پرتاب نمی‌شود) تأثیر می‌گذارد ( Ic3e08 ، b/374362482 )
  • در معیارهای CpuEventCounter ، اگر اندازه‌گیری‌های نامعتبر مشاهده شد، پرتاب کنید (مثلاً دستورالعمل‌ها/cpucycles==0) ​​( I8c503 )

نسخه 1.4.0-alpha03

16 اکتبر 2024

androidx.benchmark:benchmark-*:1.4.0-alpha03 منتشر شد. نسخه 1.4.0-alpha03 حاوی این commit ها است.

تغییرات API

  • Macrobenchmark : ArtMetric را اضافه می‌کند، که می‌تواند برای بررسی پوشش نمایه یا عملکرد کلی Android RunTime استفاده شود. تعداد و کل مدت JIT، کلاس اولیه (در صورت وجود) و تأیید کلاس را ضبط می کند. علاوه بر این، CaptureInfo تغییر می‌دهد تا نسخه اصلی ART اختیاری با پیش‌فرض را شامل شود. ( I930f7 )
  • coefficientOfVariation به خروجی بنچمارک JSON اضافه کنید تا ثبات را در یک اجرای معیار مشخص نشان دهید. ( Ib14ea )

رفع اشکال

  • هنگامی که دستگاه AVD دارای فضای خالی باشد، CollectBaselineProfileTask رفع کرد. ( Ia0225 , b/371642809 )
  • رفع احتمالی خطاهای StartupMode.COLD استثنائات: Package <packagename> must not be running prior to cold start! . اکنون، MacrobenchmarkScope.killProcess() (شامل یک اجرا قبل از هر تکرار، که برای اجرای StartupMode.COLD استفاده می‌شود) منتظر می‌ماند تا بررسی کند که فرآیندهای برنامه همه اجرا نشده‌اند. ( I60aa6 , b/351582215 )
  • مشکلی که در آن خطای UNLOCKED_ در برخی شبیه سازهای روت شده نشان داده می شد، برطرف شد. ( IC5117 )
  • این کتابخانه اکنون از حاشیه‌نویسی‌های پوچ JSpecify استفاده می‌کند که نوع استفاده هستند. توسعه دهندگان Kotlin باید از آرگومان های کامپایلر زیر برای اعمال استفاده صحیح استفاده کنند: -Xjspecify-annotations=strict ، -Xtype-enhancement-improvements-strict-mode ( I7104f ، b/326456246 )

نسخه 1.4.0-alpha02

2 اکتبر 2024

androidx.benchmark:benchmark-*:1.4.0-alpha02 منتشر شد. نسخه 1.4.0-alpha02 حاوی این تعهدات است.

تغییرات API

  • Gradle به جای در دسترس بودن در سطح بالا، ساعت‌ها lockClocks و unlockClocks تا در پروژه‌های معیار قرار بگیرند. این تغییر ضروری بود زیرا متأسفانه هیچ راهی برای ثبت این اقدامات به عنوان اقدامات سطح بالا بدون شکستن انزوای پروژه وجود ندارد. ( I02b8f , b/363325823 )

رفع اشکال

  • اکنون BaselineProfileRule با سیگنال دادن به هر فرآیند در حال اجرا در انتهای بلوک، پروفایل‌ها را برای برنامه‌های چند فرآیندی جمع‌آوری می‌کند تا پروفایل‌ها را تخلیه کند. اگر یک کامپایل مبتنی بر نمایه هرگز با موفقیت فرآیندی برای پخش پیدا نکند، کامپایل با شکست مواجه می‌شود، زیرا غیرمنتظره است که داده‌های نمایه در آن وجود داشته باشد. علاوه بر این، یک آرگومان ابزار دقیق برای کنترل مدت زمان انتظار dump اضافه کرد: androidx.benchmark.saveProfileWaitMillis ( I0f519 ، b/366231469 )
  • از معیار 1.3.2 : آزمایشگاه آزمایشی Firebase ثابت (FTL) که قادر به کشیدن فایل‌های نمایه خط پایه یا نتایج Macrobenchmark از پلاگین Baseline Profile Gradle نیست. ( I2f678 , b/285187547 )

برای استفاده از FTL، افزونه را به ماژول نمایه پایه در بلوک افزونه اعمال کنید، با:

  plugins {
      ...
      id("com.google.firebase.testlab")
  }

و سپس آزمایشگاه تست Firebase را با استفاده از:

  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
  }

نسخه 1.4.0-alpha01

18 سپتامبر 2024

androidx.benchmark:benchmark-*:1.4.0-alpha01 منتشر شد. نسخه 1.4.0-alpha01 حاوی این تعهدات است.

ویژگی جدید - Insights Startup App

  • نسخه اولیه بینش راه اندازی برنامه را می توان در 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 )
  • معیارهای Microbench اکنون در Traces Perfetto به عنوان شمارنده نمایش داده می شوند. ( 3214854 )
  • اسکریپت‌های آزمایشی را برای غیرفعال کردن jit (نیاز به راه‌اندازی مجدد ریشه / زمان اجرا) و بازنشانی وضعیت عملکرد/تست دستگاه اضافه کنید. اینها در حال حاضر به عنوان تکالیف gradle منتشر نمی شوند. ( 7c3732b )
  • آرگومان معیار برای رد شدن از تست ها هنگام اجرا در شبیه ساز اضافه شد. وقتی automaticGenerationDuring build فعال باشد، بنچمارک ها نیز باعث ایجاد نمایه پایه می شوند. اگر از شبیه سازها استفاده شود، این کار با شکست مواجه خواهد شد. با آرگومان جدید skipBenchmarksOnEmulator می‌توانیم به جای آن از آزمایش صرف نظر کنیم. ( 0c2ddcd )
  • تغییر رویداد perf فعال کردن منطق برای اجرا در API 23+ ( 2550048 )

تغییرات API

  • آرگومان آزمایشی PerfettoConfig موجود به MacrobenchmarkRule.measureRepeated() به شی ExperimentalConfig جدید منتقل شد.

رفع اشکال

  • افزایش تعداد تلاش مجدد lockClocks.sh ( 99e9dac )
  • در صورت وجود، انواع ساخت های nonMinified و بنچمارک ایجاد نکنید. به دلیل وجود یک اشکال، حتی اگر انواع ساخت‌های nonMinified و بنچمارک وجود داشت، قرار بود دوباره ایجاد شوند. ( e75f0a5 )
  • برش های غیر پایانی از نتایج TraceSectionMetric را نادیده بگیرید. ( a927d20 )
  • بررسی شبیه ساز بهبود یافته برای در نظر گرفتن پیشوند sdk_ . ( 1587de8 )
  • بسته‌های در حال اجرا را همانطور که در FrameTimingGfxInfoMetric پاک شده‌اند، در نظر بگیرید. ( 35cc79c )
  • رفع اشکال androidx.benchmark.cpuEventCounter مقادیر فاسد را برای رویدادهای غیر دستورالعمل تولید می کند. ( 06edd59 )
  • resumeTiming/runWithTimingDisabled را برطرف کنید تا به ترتیب اولویت های متریک احترام گذاشته شود و تأثیر مکث/رزومه متریک با اولویت پایین تر بر نتایج متریک با اولویت بالاتر را به میزان قابل توجهی کاهش دهید. برای مثال، اگر از شمارنده‌های cpu perf از طریق آرگومان ابزار دقیق cpuEventCounter.enable استفاده کنید، زمانی که مکث/رزومه اتفاق می‌افتد، دیگر زمان‌ها به‌طور قابل توجهی کاهش نمی‌یابد. ( 5de0968 )

نسخه 1.3

نسخه 1.3.4

26 مارس 2025

androidx.benchmark:benchmark-*:1.3.4 منتشر شد. نسخه 1.3.4 شامل این commit ها است.

رفع اشکال

  • رفع ناسازگاری‌های جداسازی پروژه Gradle در پلاگین Gradle Baseline Benchmark. ( b/404523257 )

نسخه 1.3.3

16 اکتبر 2024

androidx.benchmark:benchmark-*:1.3.3 منتشر شد. نسخه 1.3.3 حاوی این commit ها است.

رفع اشکال

  • هنگامی که دستگاه AVD دارای فضاهای خالی باشد، CollectBaselineProfileTask رفع کرد ( Ia0225 , b/371642809 )

نسخه 1.3.2

2 اکتبر 2024

androidx.benchmark:benchmark-*:1.3.2 منتشر شد. نسخه 1.3.2 شامل این commit ها است.

رفع اشکال

  • ثابت شده است که آزمایشگاه تست Firebase (FTL) قادر به بیرون آوردن فایل‌های نمایه خط پایه یا نتایج ماکرو بنچمارک از پلاگین Gradle Profile Baseline نیست. ( I2f678 , b/285187547 )

برای استفاده از FTL، افزونه را به ماژول نمایه پایه در بلوک افزونه اعمال کنید، با:

  plugins {
      ...
      id("com.google.firebase.testlab")
  }

و سپس آزمایشگاه تست Firebase را با استفاده از:

  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
  }

نسخه 1.3.1

18 سپتامبر 2024

androidx.benchmark:benchmark-*:1.3.1 منتشر شد. نسخه 1.3.1 حاوی این commit ها است.

رفع اشکال

  • ویژگی gradle اضافه شد androidx.baselineprofile.suppressWarnings برای سرکوب همه هشدارهای نمایه پایه ( I7c36e , b/349646646 )
  • پلاگین Gradle Profile Baseline را برای استفاده از nonMinified… از قبل موجود و benchmark… در صورت ایجاد توسط برنامه به جای ایجاد بسته‌بندی، رفع کرد. ( Ia8934 , b/361370179 )
  • java.lang.AssertionError: ERRORS (not suppressed): EMULATOR زمانی که automaticGenerationDuringBuild در شبیه سازها فعال است. از آرگومان جدید برای رد شدن از آزمون استفاده می شود. ( If3f51 , b/355515798 )
  • کوچک‌سازی Microbenchmark - زیرکلاس‌های org.junit.runner.notification.RunListener را در کتابخانه محک نگه دارید ( Ic8ed5 , b/354264743 )
  • TraceSectionMetric برای نادیده گرفتن برش های غیر پایانی رفع کنید. قبلاً اینها مدت زمان -1 در نظر گرفته می شدند، به عنوان مثال در حین جمع بندی یا یافتن حداقل مدت زمان. ( If74b7 )
  • مشکلی در FrameTimingGfxInfoMetric برطرف شد که در آن شروع متریک در صورتی که فرآیند از قبل اجرا نشده بود از کار بیفتد. ( I6e412 )

نسخه 1.3.0

21 آگوست 2024

androidx.benchmark:benchmark-*:1.3.0 منتشر شد. نسخه 1.3.0 شامل این commit ها است.

Microbenchmark از 1.2.0 تغییر کرده است

  • ردیابی روش به‌طور پیش‌فرض در microbenchmark‌ها هنگام اجرا در اکثر دستگاه‌ها روشن است
    • ردیابی روش به عنوان یک فاز جداگانه، پس از اندازه‌گیری‌ها اجرا می‌شود - این امکان اندازه‌گیری دقیق و ردیابی روش را فراهم می‌کند تا هر دو از یک اجرای معیار منفرد خروجی شوند.
    • ردیابی روش در برخی از نسخه‌های سیستم‌عامل Android و ART بر مراحل اندازه‌گیری بعدی تأثیر می‌گذارد - در این نسخه‌ها، ردیابی روش به‌طور پیش‌فرض خاموش است و یک هشدار در خروجی Studio چاپ می‌شود.
  • معیارهای رشته اصلی و ANR
    • به منظور جلوگیری از ANR هنگام اجرا برای چند ثانیه، measureRepeatedOnMainThread برای معیارهای رشته رابط کاربری (مثلاً آنهایی که با رابط‌های کاربری Compose/View تعامل می‌کنند) اضافه شده است.
    • اگر انتظار می رود مهلت اجتناب از ANR فراتر رود، ردیابی روش نادیده گرفته می شود. برای غیرفعال کردن این رفتار، androidx.benchmark.profiling.skipWhenDurationRisksAnr را روی false تنظیم کنید (برای اجرای CI توصیه نمی شود، زیرا ANR می تواند در اجرای طولانی CI مشکل ایجاد کند).
  • کوچک سازی
    • قوانین محافظ تعبیه شده برای بهبود معیارهای میکرو با فعال کردن کوچک‌سازی
    • Minification/R8 در یک ماژول کتابخانه به AGP 8.3 نیاز دارد و می تواند از طریق android.buildTypes.release.androidTest.enableMinification در build.gradle شما فعال شود.
    • API آزمایشی BlackHole.consume() برای جلوگیری از حذف کد مرده اضافه شد ( If6812 ، b/286091643 )
  • معیارها
    • ویژگی شمارنده رویداد تجربی cpu (معیارها از perf_event_open ، که در اکثر نسخه‌های پلتفرم نیاز به روت دارد)، دسترسی از طریق InstrumentationArgument androidx.benchmark.cpuEventCounter.enable (می‌تواند روی true تنظیم شود)، و androidx.benchmark.cpuEventCounter.events ( Instructions,CpuCycles . این باید در برخی از شبیه سازهای خطای کاربر پشتیبانی شود، اما پشتیبانی در همه شبیه سازهای موجود آزمایش نشده است.

MACRObenchmark از 1.2.0 تغییر کرده است

  • بازنگری کلی روش ردیابی برای معیارهای کلان.
    • اکنون ردیابی‌های متد به مدت زمان measureBlock می‌شوند و اگر فرآیند چندین بار شروع شود، می‌توانند چندین جلسه را ضبط کنند.
    • قبلاً، روش ردیابی فقط برای معیارهای StartupMode.COLD کار می کرد و هیچ چیزی را برای measureBlocks که فرآیند هدف را مجدداً راه اندازی نمی کردند، نمی گرفت.
    • ردیابی روش ثابت در ماکرو بنچمارک همسطح است، بنابراین ردیابی روش باید کاملاً ثبت و معتبر باشد، حتی در دستگاه‌های کندتر. ( I6349a , b/329904950 )
  • هنگام از بین رفتن فرآیند، نمایه ART را در طول تکرارهای warmUp فردی به درستی تخلیه کنید تا اندازه گیری CompilationMode.Partial(warmup=N) دقیق تر باشد. ( I17923 )
  • پیام خرابی پخش Drop Shader
    • پیشنهادات اشکال زدایی برای حذف پیام خرابی پخش سایه زن اضافه شد
    • هنگام محک زدن برنامه‌ها بدون ProfileInstaller 1.3، دو آرگومان ابزار دقیق برای نادیده گرفتن رفتار حذف سایه‌زن به خرابی‌های راه‌حل اضافه کنید:
      • androidx.benchmark.dropShaders.enable=true/false : می‌توان برای رد کردن تمام سایه‌بان‌ها (از جمله مواردی که در راه‌اندازی StartupMode.Cold انجام می‌شود) استفاده کرد، به‌ویژه هنگام محک زدن برنامه‌هایی که هنوز از profileinstaller 1.3 استفاده نمی‌کنند.
      • androidx.benchmark.dropShaders.throwOnFailure=true/false : می تواند برای تحمل شکست در هنگام حذف سایه بان ها، به عنوان مثال هنگام محک زدن برنامه های بدون profileinstaller 1.3 ( I4f573 ) استفاده شود.
  • نسخه آزمایشی MacrobenchmarkRule#measureRepeated اضافه شد که یک PerfettoConfig سفارشی برای ضبط ردیابی Perfetto کاملا سفارشی می گیرد. توجه داشته باشید که پیکربندی‌های نادرست ممکن است باعث خرابی کلاس‌های متریک داخلی شوند. ( Idfd3d , b/309841164 , b/304038384 )
  • برای کاهش تداخل، قبل از اجرای Macrobenchmark، کارهای dexopt پس‌زمینه را لغو کنید. ( I989ed )
  • Macrobenchmark اکنون 1 ثانیه منتظر می ماند تا برنامه مورد نظر نمایه ART را شستشو دهد (قبلاً 500 میلی ثانیه منتظر می ماند). ( I85a50 , b/316082056 )
  • تعمیرات اساسی TraceSectionMetric
    • توجه : تغییرات TraceSectionMetric زیر می‌تواند بر خروجی‌ها در استفاده از CI تأثیر بگذارد و ممکن است ناپیوستگی ایجاد کند یا تجزیه را خراب کند.
    • Sum اکنون پیش‌فرض است، زیرا بیشترین استفاده از این معیار برای رویدادهای مکرر است و ابتدا داده‌ها در این موارد حذف می‌شوند.
    • با حالت‌های در دسترس بیشتر، برای سفارشی‌سازی بیشتر تغییر کرد
    • نام حالت اکنون در نام خروجی متریک (در استودیو و JSON) جاسازی شده است.
    • اکنون از برش های ایجاد شده با استفاده از Trace.{begin|end}AsyncSection .
  • معیارها
    • Power - اضافه شده PowerMetric.deviceSupportsHighPrecisionTracking ، PowerMetric.deviceBatteryHasMinimumCharge() و PowerMetric.deviceSupportsPowerEnergy()
    • Metric.getResult به getMeasurements تغییر نام داد تا با نوع بازگشتی مطابقت داشته باشد
    • برچسب‌های log.w / استثنا به همه خرابی‌های تشخیص راه‌اندازی اضافه شد. این رفتار فعلی را تغییر نمی‌دهد (بنابراین برخی از خطاها پرتاب می‌شوند و برخی دیگر بی‌صدا راه‌اندازی را شناسایی نمی‌کنند)، فقط آن را قابل درک‌تر می‌کند. معمولاً مواردی که 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 از نسخه 1.2.0 تغییر می کند

  • حداکثر نسخه توصیه شده AGP به 9.0.0-alpha01 افزایش یافت.
  • اطمینان حاصل کنید که وظایف mergeArtProfile و mergeStartupProfile همیشه منتظر تولید نمایه پایه هستند. ( I623d6 , b/343086054 )
  • ایجاد یک نمایه پایه با موفقیت، خلاصه‌ای از آنچه تغییر کرده است به دست می‌دهد ( I824c8 , b/269484510 )
  • DSL برای غیرفعال کردن هشدارها اضافه شد ( Ic4deb , b/331237001 )
  • برای اطمینان از اینکه وقتی automaticGenerationDuringBuild غیرفعال است، معیارها از پروفایل‌های پایه تولید شده استفاده می‌کنند ( Ic144f , b/333024280 ) رفع کنید.
  • اصلاح ویژگی پلاگین BaselineProfile gradle برای فعال کردن تولید نمایه پایه و محک زدن هنگام سفارشی کردن نوع ساخت nonMinified یا معیار. ( Ib8f05 , b/324837887 )
  • رفع نمایه‌های پایه کتابخانه در AAR قبل از AGP 8.3.0-alpha15. ( I1d2af , b/313992099 )
  • نشانی وب خروجی خط پایه و نمایه راه‌اندازی در پایان کار ثابت شد. ( I802e5 , b/313976958 )

سایر تغییرات قابل توجه از 1.2.0

  • ضبط ردیابی
    • کاهش خطای EXITCODE 2 هنگام شروع perfetto از یک خطا به هشدار ثبت شده
    • ردیابی AIDL را به طور پیش‌فرض در معیارها فعال کنید (به API 28 نیاز دارد) ( Ia0af2 ، b/341852305 )
    • ردیابی برچسب پورتر را به طور پیش فرض در معیارها فعال کنید. این برای مثال، نقاط ردیابی wakelock را می گیرد. ( Icfe44 , b/286551983 )
    • افزایش زمان شروع ضبط ردیابی برای جلوگیری از خرابی هنگام شروع ردیابی در دستگاه‌های کندتر ( I98841 , b/329145808 )
    • APIهای عمومی PerfettoTraceProcessor.Session.queryMetrics با انواع JSON، textproto و پروتو باینری (کد نشده) اضافه شد. اینها به شما امکان می دهند معیارهای تعبیه شده در TraceProcessor را جستجو کنید ( I54d7f , b/304038382 )
    • شروع مسدود کردن را در رکورد ردیابی Perfetto فعال کنید تا خطر گم شدن داده ها در ابتدای ردیابی کاهش یابد. فقط در API 33+ پشتیبانی می شود. ( Ie6e41 , b/310760059 )
  • خروجی JSON
    • اطلاعات اضافی در زمینه معیار در خروجی JSON اضافه شده است:
      • context.artMainlineVersion - نسخه عدد صحیح ماژول خط اصلی Art (در صورت وجود در دستگاه، -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 traces) ( I05ddd ، b/332604449 )
    • هنگامی که از Android Test Orchestrator در ماژول‌های بنچمارک استفاده می‌شود، هشدار اضافه شد، زیرا باعث می‌شود فایل‌های JSON خروجی هر ماژول به‌طور مکرر بازنویسی شوند. ( Ia1af6 , b/286899049 )
    • برای جلوگیری از خرابی نامشخص در هنگام نوشتن یا پس از پردازش فایل، زمانی که نام فایل‌ها بیش از 200 کاراکتر هستند، آن را پرتاب کنید. ( I4a5ab )

نسخه 1.3.0-rc01

7 آگوست 2024

androidx.benchmark:benchmark-*:1.3.0-rc01 منتشر شد. نسخه 1.3.0-rc01 حاوی این commit ها است.

رفع اشکال

  • رفع androidx.benchmark.cpuEventCounter تولید مقادیر خراب برای رویدادهای غیر دستورالعمل ( I7386a ، b/286306579 )
  • resumeTiming / runWithTimingDisabled را رفع کنید تا به ترتیب اولویت های متریک احترام گذاشته شود و تأثیر مکث/رزومه متریک با اولویت کمتر بر نتایج متریک با اولویت بالاتر را به میزان قابل توجهی کاهش دهید. برای مثال، اگر از شمارنده‌های cpu perf از طریق آرگومان ابزار دقیق cpuEventCounter.enable استفاده کنید، زمانی که مکث/رزومه اتفاق می‌افتد، دیگر زمان‌ها به‌طور قابل توجهی کاهش نمی‌یابد. ( 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 استفاده نمی‌کنند، توصیه می‌شود به نسخه 8.1 یا بالاتر D8 به‌روزرسانی کنند. برای جزئیات بیشتر به این مقاله مراجعه کنید. ( I9496c , b/345472586 )
  • بررسی نسخه agp برای ارسال نام بسته به عنوان instr arg اضافه شد. قبل از AGP 8.4.0، نام بسته برنامه هدف را نمی توان از طریق آرگومان های ابزار دقیق به برنامه ابزار دقیق ارسال کرد. ( 0c72a3f )

نسخه 1.3.0-beta02

10 جولای 2024

androidx.benchmark:benchmark-*:1.3.0-beta02 منتشر شد. نسخه 1.3.0-beta02 حاوی این تعهدات است.

رفع اشکال

  • هنگام شروع Perfetto برای ثبت هشدار، EXITCODE 2 را به خوبی مدیریت کنید، اما ادامه دهید.

نسخه 1.3.0-beta01

12 ژوئن 2024

androidx.benchmark:benchmark-*:1.3.0-beta01 منتشر شد. نسخه 1.3.0-beta01 حاوی این تعهدات است.

تغییرات API

  • نام MethodTracing.affectsMeasurementOnThisDevice را به AFFECTS_MEASUREMENT_ON_THIS_DEVICE تغییر داد. ( I1bdfa )
  • Api آزمایشی BlackHole.consume() برای جلوگیری از حذف کد مرده در میکروبنچمارک ها اضافه شد. ( If6812 , b/286091643 )
  • Microbenchmark اکنون به درستی پرتاب می شود تا از تداخل ردیابی روش در اندازه گیری ها جلوگیری کند. هنگامی که ردیابی روش به اجبار روشن می شود (از طریق args ابزار دقیق یا MicrobenchmarkConfig )، و اگر اندازه گیری بعد از ردیابی متد انجام شود، در دستگاه های خاصی رخ می دهد. دستگاه‌های آسیب‌دیده API 26-30 یا نسخه‌های خاصی از ماژول خط اصلی ART را اجرا می‌کنند که تحت تأثیر این تداخل قرار گرفته‌اند و می‌توانند در زمان اجرا از طریق ProfilerConfig.MethodTracing.affectsMeasurementOnThisDevice شناسایی شوند. ( Iafb92 , b/303660864 )

رفع اشکال

  • نسخه bumped max agp به 9.0.0-alpha01 توصیه می شود. ( I5bbb0 )
  • حالت کامپایل به زمینه معیار اضافه شد ( If5612 , b/325512900 )
  • AIDL tracing را به طور پیش‌فرض فعال کنید (به API 28 نیاز دارد) ( Ia0af2 ، b/341852305 )
  • اطلاعات اضافی در زمینه معیار در خروجی JSON اضافه شده است:
    • context.artMainlineVersion - نسخه عدد صحیح ماژول خط اصلی Art (در صورت وجود در دستگاه، -1 در غیر این صورت)
    • context.build.id - برابر با android.os.Build.ID است
    • context.build.version.codename - برابر با android.os.Build.VERSION.CODENAME
    • context.build.version.abbreviatedCodename - مربوط به حرف اول نام رمز پیش از انتشار (حتی در نسخه های انتشار) ( Ie5020 )
  • StackSampling برای احترام به androidx.benchmark.profiling.sampleDurationSeconds اصلاح می کند ( Ib1d53 )
  • وابستگی macro->common را به api() تغییر دهید، بنابراین استفاده از آن برای مثال PerfettoTrace و PerfettoConfig آسانتر است. ( Icdae3 , b/341851833 )
  • اطمینان حاصل کنید که وظایف mergeArtProfile و mergeStartupProfile همیشه منتظر تولید نمایه پایه هستند. ( I623d6 , b/343086054 )
  • هنگام تصمیم گیری در مورد اینکه آیا باید فعال شود یا خیر، حالت فعال کردن متغیر را در نظر بگیرید. ( I5d19e , b/343249144 )
  • افزایش زمان شروع پیش‌فرض پردازنده perfetto trace. ( I87e8c , b/329145808 )

نسخه 1.3.0-alpha05

14 مه 2024

androidx.benchmark:benchmark-*:1.3.0-alpha05 منتشر شد. نسخه 1.3.0-alpha05 حاوی این تعهدات است.

رفع اشکال

  • هنگامی که متریک macrobench مقادیر صفر را برای همه تکرارها برمی‌گرداند، استثنا واضح‌تری ایجاد کنید ( Iab58f , b/314931695 )
  • قوانین راه‌حل اضافی به قوانین محافظ microbench اضافه شده است، از جمله پشتیبانی از قوانین شنونده و سایر هشدارها / خطاهای مشاهده شده. ( I14d8f , b/329126308 , b/339085669 )
  • ردیابی روش به عنوان یک فاز جداگانه در طول یک Macrobenchmark اجرا می شود و دیگر بر اندازه گیری ها تأثیر نمی گذارد. ( If9a50 , b/285912360 , b/336588271 )
  • پیشنهادات رفع اشکال اضافی برای حذف پیام خرابی پخش سایه زن اضافه شده است. ( I5efa6 , b/325502725 )

نسخه 1.3.0-alpha04

1 مه 2024

androidx.benchmark:benchmark-*:1.3.0-alpha04 منتشر شد. نسخه 1.3.0-alpha04 حاوی این commit ها است.

تغییرات API

  • نسخه آزمایشی MacrobenchmarkRule#measureRepeated اضافه شد که یک PerfettoConfig سفارشی برای ضبط ردیابی Perfetto کاملا سفارشی می گیرد. توجه داشته باشید که پیکربندی‌های نادرست ممکن است باعث خرابی کلاس‌های متریک داخلی شوند. ( Idfd3d , b/309841164 , b/304038384 )
  • تغییر نام PowerMetric.deviceSupportsPowerEnergy به PowerMetric.deviceSupportsHighPrecisionTracking برای وضوح ( I5b82f )
  • PowerMetric.deviceBatteryHasMinimumCharge() و PowerMetric.deviceSupportsPowerEnergy() برای فعال کردن تغییر یا رد کردن معیارها بر اساس قابلیت اندازه‌گیری توان دستگاه اضافه شد. ( I6a591 , b/322121218 )

رفع اشکال

  • مقایسه اضافه شده با نمایه پایه قبلی ( I824c8 , b/269484510 )
  • DSL برای غیرفعال کردن هشدارها اضافه شد ( Ic4deb , b/331237001 )
  • هنگامی که انواع معیار غیرفعال هستند، استثنا برای گزارش اطلاعات تغییر کرد ( I8a517 , b/332772491 )
  • ساده‌تر کردن ردیابی متد برای یک Macrobenchmark به مدت زمان measureBlock() Block. قبلاً از راه اندازی فرآیند هدف شروع می شد و فقط از شروع سرد پشتیبانی می کرد ( Iee85a , b/300651094 )
  • هنگامی که پردازنده perfetto trace کند شروع می شود از خراب شدن خودداری کنید ( I98841 , b/329145808 )

نسخه 1.3.0-alpha03

17 آوریل 2024

androidx.benchmark:benchmark-*:1.3.0-alpha03 منتشر شد. نسخه 1.3.0-alpha03 حاوی این تعهدات است.

ویژگی های جدید

  • APIهای عمومی PerfettoTraceProcessor.Session.queryMetrics را با انواع JSON، textproto و پروتو باینری (کد نشده) اضافه می کند. اینها به شما امکان می دهند معیارهای تعبیه شده در TraceProcessor را جستجو کنید ( I54d7f , b/304038382 )
  • profilerOutput به خروجی JSON اضافه شد تا ابزار آسان‌تری در اطراف ردیابی‌های پروفایل (به عنوان مثال perfetto، ردیابی روش). ( I05ddd , b/332604449 )
  • برچسب پاور به معیار Perfetto Config اضافه شد. این برای مثال، نقاط ردیابی wakelock را می گیرد. ( Icfe44 , b/286551983 )
  • آرگومان inst androidx.benchmark.profiling.skipWhenDurationRisksAnr اضافه شد، می‌توان آن را روی false تنظیم کرد تا از رد شدن ردیابی روش جلوگیری شود، زمانی که مدت زمان مورد انتظار ممکن است باعث ANR شود - اکیداً توصیه می‌شود در اجرای CI از آن اجتناب شود.
  • اضافه شده استدلال Inst تجربی androidx.benchmark.profiling.perfCompare.enable ، این را برای درست کردن زمان مقایسه بین مراحل اندازه گیری و پروفایل تنظیم کنید. در EG مفید ارزیابی سربار ردیابی روش مفید است. ( i61fb4 ، b/329146942 )

تغییرات API

  • تغییر یافته TraceSectionMetric.Mode به کلاس مهر و موم شده برای فعال کردن گسترش آینده بدون شکستن جامع هنگام بیانیه ها ( I71F7B )
  • اضافه شده TraceSectionMetric.Mode.Average AVERATION AND .Count ، و مجدداً Arg می دهد ، بنابراین آرگومان متداول (MODE) در لیست ARG زودتر بود و نیاز به مشخص کردن نام پارامترها را کاهش می داد. ( IBF0B0 ، B/315830077 ، B/322167531 )
  • برای مطابقت با نوع بازگشت ( I42595 ) getMeasurements Metric.getResult تغییر نام داد

رفع اشکال

  • رفع مشکل برای اطمینان از استفاده از معیارها از پروفایل های پایه تولید شده در هنگام خاموش بودن automaticGenerationDuringBuild ( IC144F ، B/333024280 )
  • ویژگی افزونه Gradle BaselineProfile را برطرف کنید تا در هنگام شخصی سازی یک نوع ساخت nonMinified یا معیار ، تولید مشخصات و معیار پایه را فعال کنید. ( IB8F05 ، B/324837887 )
  • روشهای ثابت در ماکروبنچارک آثار می کنند ، به طوری که آثار روش باید کاملاً ضبط و معتبر باشد ، حتی در دستگاه های کندتر. ( i6349a ، b/329904950 )
  • فعال کردن شروع کار در رکورد Perfetto Trace برای کاهش خطر از دست دادن داده ها در ابتدای ردیابی. فقط در API 33+ پشتیبانی می شود. ( IE6E41 ، B/310760059 )
  • هنگامی که ارکستر تست اندرویدی در ماژول های معیار استفاده می شود ، هشدار اضافه کرد ، زیرا این امر باعث می شود پرونده های خروجی هر ماژول به طور مکرر رونویسی شوند. ( IA1AF6 ، B/286899049 )
  • نیرو '،' (کاما) هزاران جداکننده برای سازگاری در خروجی استودیو ، نادیده گرفتن محل دستگاه ( I3E921 ، B/313496656 )
  • اکنون TraceSectionMetric از برشهای ایجاد شده با استفاده از Trace.{begin|end}AsyncSection . ( i91b32 ، b/300434906 )
  • برچسب های log.w / استثناء به همه خرابی های تشخیص راه اندازی. این رفتار فعلی را تغییر نمی دهد (بنابراین برخی از خطاها پرتاب می شوند ، و برخی دیگر در سکوت در تشخیص راه اندازی ناکام هستند) ، فقط آن را قابل درک تر می کند. به طور کلی مواردی که Log.w() و نتوانند معیارهای راه اندازی را گزارش دهند ، مواردی هستند که رویدادهای غیر قاب از دست می روند ، استثنائاتی در هنگام شناسایی استثناء به جز اطلاعات زمان بندی فریم (از برش های UI/RT) پرتاب می شود. ( id240f ، b/329145809 )
  • قبل از اجرای یک ماکروبچارک برای کاهش تداخل ، مشاغل Dexopt را لغو کنید. ( i989ed )
  • اندازه گیری frameCount به FrameTimingMetric برای کمک به کشف سناریوها که در آن اندازه گیری ها تغییر می کنند ، اضافه شده است زیرا تعداد فریم های تولید شده تغییر یافته است (انیمیشن های جدید اضافه شده ، مشکلات نامعتبر ثابت می شوند). ( i1e5aa )
  • روشن کرد که frameOverrunMs متریک ارجح برای ردیابی در صورت وجود در اسناد است و چرا. ( i18749 ، b/329478323 )

نسخه 1.3.0-alpha02

20 مارس 2024

androidx.benchmark:benchmark-*:1.3.0-alpha02 منتشر می شود. نسخه 1.3.0-alpha02 شامل این تعهدات است.

ویژگی های جدید

  • پشتیبانی آزمایشی R8 در میکروبن از طریق قوانین Proguard تعبیه شده. توجه داشته باشید که این پشتیبانی آزمایشی است و برای اندازه گیری تست های ماژول کتابخانه به AGP 8.3 نیاز دارد. از موارد زیر استفاده کنید تا بتوانید Minification/Optimization R8 را در build.gradle ماژول معیار خود فعال کنید. Gradle ، که بسته به بار کار باید منجر به افزایش عملکرد قابل توجهی شود. ( i738a3 ، b/184378053 )

    android {
        buildTypes.release.androidTest.enableMinification = true
    }
    

رفع اشکال

  • روش ردیابی روش را برطرف می کند تا از خروجی میکروبن در خط جداگانه قرار بگیرد. ( I0455C ، B/328308833 )

نسخه 1.3.0-alpha01

21 فوریه 2024

androidx.benchmark:benchmark-*:1.3.0-alpha01 منتشر می شود. نسخه 1.3.0-alpha01 شامل این تعهدات است.

تغییرات API

  • برای جلوگیری از کلمه غیر ضروری "باید" ( IA8F00 ، B/303387299 ) به MicrobenchmarkConfig Boolean تغییر نام داد
  • اضافه شده BenchmarkRule.measureRepeatedOnMainThread بنابراین معیارهای اصلی نخ (به عنوان مثال آنهایی که نمودارها را لمس می کنند یا UI را آهنگسازی می کنند) می توانند از ایجاد ANR ، به ویژه در سوئیت های بزرگ در CI جلوگیری کنند. ( i5c86d )
  • اضافه شده FrameTimingGfxInfoMetric ، اجرای متناوب آزمایشی از FrameTimingMetric با اندازه گیری های مستقیم از سکو ، به جای استخراج از ردیابی پرفتو. ( i457cb ، b/322232828 )
  • توانایی ریختن پروفایل هنری را در حین تکرار warmUp فردی اضافه کنید. ( I17923 )
  • چندین تغییر در API TraceSectionMetric :
    • اضافه کردن Mode.Min ، Mode.Max
    • آرگومان برچسب را اضافه کنید تا نام بخش را به عنوان برچسب متریک نادیده بگیرید
    • نام حالت اضافه شده به خروجی برای روشن شدن معنی متریک
    • به طور پیش فرض تغییر کرده است ، زیرا بیشتر استفاده از این متریک برای رویدادهای مکرر است که از این تغییرات در استفاده از CI آگاه باشید ، زیرا ممکن است ناپیوستگی ایجاد کند یا تجزیه را بشکند. ( IC1E82 ، B/301892382 ، B/301955938 )

رفع اشکال

  • پیام خطای بهبود یافته در افزونه Profile Profile Gradle هنگامی که دستگاه مدیریت شده مشخص شده وجود ندارد ( IDEA2B ، B/313803289 )
  • رفع پروفایل های پایه کتابخانه در AAR قبل از AGP 8.3.0-alpha15 ( I1D2AF ، B/313992099 )
  • URL اولیه پایه و راه اندازی پروفایل راه اندازی در پایان کار نسل ( I802E5 ، B/313976958 )
  • تنظیمات منبع داده تنظیم شده برای تلاش برای رفع java.lang.IllegalStateException: Failed to stop [ProcessPid(processName=perfetto, pid=...)] ( i8dc7d ، b/323601788 )
  • دو استدلال ابزار دقیق را برای جلوگیری از رفتار سایه بان در هنگام معیار برنامه های بدون ProfileInstaller 1.3 اضافه کنید:
    • androidx.benchmark.dropShaders.enable=true/false : می تواند برای پرش از همه رها کردن سایه بان استفاده شود (از جمله آن که در راه اندازی StartupMode.Cold است.
    • androidx.benchmark.dropShaders.throwOnFailure=true/false : می تواند برای تحمل خرابی هنگام تلاش برای رها کردن سایه بان ها استفاده شود ، به عنوان مثال هنگامی که برنامه های معیار بدون پروفایل 1.3 ( i4f573 )
  • ردیابی روش ردیابی روی نخ UI در صورت انتظار می رود بیش از چند ثانیه طول بکشد ، و روش پاکسازی هنگام پرتاب ردیابی می شود. ( i6e768 )
  • پرتاب هنگامی که نام پرونده ها بیش از 200 بار است تا از خرابی های نامشخص هنگام نوشتن یا پرونده های پس از پردازش جلوگیری شود. ( i4a5ab )
  • مسئله ای را برطرف می کند که قاب های بی پروا در ابتدا و انتهای ردیابی می توانند با هم جفت شوند ، که به طور نادرست به عنوان یک قاب بسیار طولانی گزارش می شود. ( i39353 ، b/322232828 )
  • هنگام نصب مجدد بسته در API 30-33 برای پاک کردن پروفایل های هنری در ساخت کاربر ، --skip verification در API 30+ استفاده کنید. این به دور زدن بازی کمک می کند تا از هشدارهایی که باعث خرابی در برخی از کلاس های دستگاه ها می شود ، محافظت کند. ( IC9E36 )
  • از am force-stop برای کشتن برنامه ها در صورت عدم برنامه سیستم مانند سیستم UI یا پرتاب استفاده کنید. ( i5e028 )
  • Macrobenchmark اکنون منتظر 1 second برای برنامه Target است تا نمایه هنری را شستشو دهد (قبلاً منتظر 500 ms بود). ( i85a50 ، b/316082056 )
  • هنگام تولید فریم ، خطای FrameTimingMetric بهبود بخشید و همیشه در هنگام عدم تجزیه متریک برای کمک به تشخیص مشکل ، به ردیابی پیوند دهید. ( i956b9 )
  • سقوط ثابت در FrameTimingMetric متماسی در تجزیه و تحلیل شناسه فریم ، به ویژه در برخی از دستگاه های OEM. ( IA24BC ، B/303823815 ، B/306235276 )
  • سخت گیری آرامش از چک در FrameMetrics ، و جزئیات بیشتری را به پیام های خطا اضافه کرد. ( iadede )

نسخه 1.2

نسخه 1.2.4

17 آوریل 2024

androidx.benchmark:benchmark-*:1.2.4 منتشر می شود. نسخه 1.2.4 شامل این تعهدات است.

رفع اشکال

  • مشخصات پایه را برطرف می کند Srcset در انواع معیار تنظیم نمی شود. همچنین در کتابخانه ها باعث ایجاد وابستگی دایره ای automaticGenerationDuringBuild شود. ( i28ab7 ، b/333024280 )
  • از am force-stop برای کشتن برنامه ها در صورت عدم برنامه سیستم مانند سیستم UI یا پرتاب استفاده کنید. این راه حل StartupMode.COLD برطرف می کند. معیارهای Cold در حال خراب شدن از "بسته بسته $ نباید قبل از شروع سرما اجرا شود!" به دلیل فرایند کشتن کاملاً موفق نیست. ( i5e028 )

نسخه 1.2.3

24 ژانویه 2024

androidx.benchmark:benchmark-*:1.2.3 منتشر می شود. نسخه 1.2.3 شامل این تعهدات است.

رفع اشکال

  • هنگامی که نسخه AGP 8.3.0 یا بالاتر است ، استثناء حذف شده از افزونه پایه پایه پایه.
  • قبل از AGP 8.3.0-alpha15 ، پروفایل های پایه کتابخانه را در AAR اصلاح کنید.

نسخه 1.2.2

1 دسامبر 2023

androidx.benchmark:benchmark-*:1.2.2 منتشر می شود. نسخه 1.2.2 شامل این تعهدات است.

پروفایل های پایه

  • سیاهههای مربوط به اجرای مسیر پرونده خروجی مشخصات پایه به عنوان یک پرونده محلی URI ( AOSP/2843918 ، AOSP/2853665 ، B/313976958 )

نسخه 1.2.1

15 نوامبر 2023

androidx.benchmark:benchmark-*:1.2.1 منتشر می شود. نسخه 1.2.1 شامل این تعهدات است.

ویژگی های جدید

  • پیام خطای بهبود یافته هنگامی که کاربر انواع تست را غیرفعال می کند ( B/307478189 )
  • خواص اضافه شده برای پشتیبانی به عنوان ادغام اجرای آزمون ( B/309805233 ) ، ( b/309116324 )

نسخه 1.2.0

18 اکتبر 2023

androidx.benchmark:benchmark-*:1.2.0 منتشر می شود. نسخه 1.2.0 شامل این تعهدات است.

تغییرات مهم از 1.1.0

پروفایل های پایه

  • افزونه جدید Profile Profile Profile به صورت خودکار ضبط و از جمله پروفایل های پایه در تست شما و ایجاد گردش کار.
  • BaselineProfileRule.collect اکنون پایدار ، یک نسخه ساده و ساده از نسخه آزمایشگاهی قبلی BaselineProfileRule.collectBaselineProfile API
    • فقط packageName مشخص کنید و برنامه خود را هدایت کنید
  • برای کتابخانه هایی که پروفایل های پایه ایجاد می کنند ، اکنون می توانید قوانین تولید شده یا در کد ( BaselineProfileRule.collect را) یا حتی به سادگی در افزونه Gradle فیلتر کنید.
  • رفع می کند
    • مجموعه مشخصات پایه ثابت در Android U+ ( ID1392 ، B/277645214 )

عکسبرداری

  • تالیف
    • Macrobenchmark اکنون به طور صحیح حالت تلفیقی را برای هر کامپایل تنظیم می کند - این امر نیاز به نصب مجدد APK قبل از Android 14 دارد ، بنابراین اگر می خواهید حالت خود را ادامه دهید (مانند ورود کاربر) در آنچه اندازه گیری می شود ، به شدت توصیه می شود.
    • همچنین می توانید با کنترل جداگانه برنامه ریزی برنامه ، و پرش از مجموعه با CompilationMode.Ignore() یا استدلال ابزار دقیق ، در این زمینه کار کنید
  • استدلال های ابزاری

    • پشتیبانی از androidx.benchmark.dryRunMode.enable Argrentation ، (قبلاً در Microbenchmark موجود است) برای اعتبارسنجی سریعتر (به عنوان مثال هنگام ایجاد معیار ، یا در presubmit)
    • پشتیبانی از androidx.benchmark.profiling.mode=StackSampling و MethodTracing .
    • androidx.benchmark.enabledRules اضافه شده است تا پروفایل پایه اولیه فیلتر در زمان اجرا در مقابل تست های قانون ماکروبنچارک فراهم شود
    • androidx.benchmark.perfettoSdkTracing.enable برای فعال کردن ردیابی با ردیابی-perfetto ، به عنوان مثال ردیابی بازپرداخت آهنگسازی اضافه شده است. توجه داشته باشید که در صورت استفاده از StartupMode.COLD ، زمان به میزان قابل توجهی تحت تأثیر قرار می گیرد زیرا کتابخانه ردیابی در هنگام راه اندازی برنامه بارگیری و فعال می شود.
  • الزامات

    • Macrobenchmark اکنون به ProfileInstaller 1.3.0 یا بیشتر در برنامه هدف نیاز دارد تا بتواند ضبط / تنظیم مجدد نمایه و پاکسازی حافظه پنهان سایه بان را فعال کند.
  • API های جدید متریک تجربی

    • TraceSectionMetric ، که امکان استخراج زمان ساده از trace("") {} بلوک در برنامه شما ، یا تراکتوتریک برای استفاده از توانایی کامل پرس و جو از پرفراتو TraceProcessor اضافه می شود.
    • PowerMetric تجربی اضافه شده برای گرفتن اطلاعات استفاده از برق
    • اضافه شده MemoryCountersMetric برای شمارش گسل های صفحه
    • اضافه شده API PerfettoTraceProcessor تجربی ، که در داخل برای استخراج معیارها از آثار سیستم استفاده می شود (با نام های Perfetto Traces)
  • رفع می کند

    • تصادفات ثابت هنگام نصب یا استخراج پروفایل از برنامه نصب شده از چندین APK (به عنوان مثال از بسته نرم افزاری برنامه).
    • فریم های نادیده گرفتن FrameTimingMetric با شناسه های فریم متناقض (به طور کلی فریم در طول موج در API 31+) ( I747D2 ، B/279088460 )
    • خطاهای تجزیه شده بر روی آثار> 64MB ( IEF831 ، B/269949822 )
    • خطاهای روشن هنگامی که دستگاه (به خصوص شبیه ساز) تصویر سیستم عامل به درستی برای ردیابی یا تدوین پیکربندی نشده است
    • سطح باتری پرش دستگاه های بدون باتری (میکرو و کلان) را بررسی کنید
    • خروجی فایل بهبود یافته ، با خطاهای واضح تر برای دایرکتوری های خروجی نامعتبر و پیش فرض های ایمن تر
    • پایداری بهبود یافته StartupMode.COLD با رها کردن مداوم حافظه نهان سایه بان (همچنین از طریق MacrobenchmarkScope.dropShaderCache در معرض دید)
    • ثابت برگشتی ثابت برای startActivityAndWait .

میکروب مارک

  • ویژگی ها
    • پروفایل پس از معیارهای دیگر به یک مرحله جداگانه منتقل شد ، بنابراین یک آزمایش آزمایش می تواند نتایج زمان بندی دقیق و پروفایل را نشان دهد.
  • APIهای آزمایشی
    • API آزمایشی MicrobenchmarkConfig برای تعریف معیارهای سفارشی و پیکربندی ردیابی و پروفایل اضافه شده است. می توان برای ضبط آثار روش یا ضبط نقاط ردیابی (اما از ردیابی سربار آگاه باشید) استفاده شود.
    • API های تجربی برای کنترل BenchmarkState به طور جداگانه از BenchmarkRule ، بدون Junit اضافه شده است
    • اضافه شده رکورد PerfettoTrace تجربی برای فعال کردن ضبط آثار Perfetto ، با پیکربندی سفارشی ، جدا از API های معیار.
  • رفع می کند
    • راه حل از دست دادن فضای سفید پیشرو در خروجی معیار استودیوی اندرویدی.
    • مشکل را برطرف کنید که هشدارها نتوانند در خروجی معیار Android Studio چاپ شوند.
    • تصادف SampledProfiling شده در Android 13 (API 33) و بالاتر.
    • عملکرد گسترده ای از dryRunMode با پرش IsolationActivity و ردیابی پرفولت (حداکثر 10 برابر سریعتر حالت خشک در نسخه های قدیمی سیستم عامل) بهبود یافته است.

نسخه 1.2.0-RC02

6 اکتبر 2023

androidx.benchmark:benchmark-*:1.2.0-rc02 منتشر می شود. نسخه 1.2.0-RC02 شامل این تعهدات است.

رفع اشکال

  • خروجی فایل معیار را برطرف کنید تا دیگر کپی کردن پرونده افزونه BaselineProfile بشکنید. پرونده ها تولید و کپی شده بودند ، اما به گونه ای تغییر نام داده شده بودند که افزونه Gradle آنها را نمی دید. ( i8dbcc ، b/303034735 ، b/296453339 )
  • پیام های خطای بارگذاری شفاف- tracing-perfetto هنگام تزریق از ماژول ماکروبچارک به برنامه هدف.

نسخه 1.2.0-RC01

20 سپتامبر 2023

androidx.benchmark:benchmark-*:1.2.0-rc01 منتشر می شود. نسخه 1.2.0-RC01 شامل این تعهدات است.

رفع اشکال

  • یک استثنا (با دستورالعمل های درمانی) اکنون هنگامی پرتاب می شود که ردیابی Perfetto SDK نتواند در یک معیار اولیه شود. ( i6c878 ، b/286228781 )
  • هنگام تبدیل روش ART TRACE -> فرمت Perfetto ، تصادف OOM را برطرف کنید. ( i106bd ، b/296905344 )
  • (Macrobenchmark) برچسب ردیابی روش روشن هنگام اتصال در خروجی تست استودیو ، و ردیابی روش های ثابت نام پرونده ها در دستگاه/میزبان منحصر به فرد است ، بنابراین با اجرای بیش از یک معیار ، آنها رونویسی نمی شوند. ( I08E65 ، B/285912360 )
  • تضمین می کند که دستگاه هنگام ضبط نمایه پایه از خواب بیدار است. ( I503FC )

نسخه 1.2.0-beta05

30 آگوست 2023

androidx.benchmark:benchmark-*:1.2.0-beta05 منتشر می شود. نسخه 1.2.0-beta05 شامل این تعهدات است.

ویژگی های جدید

  • افزونه Gradle Profile Profile اکنون از افزونه Android Gradle 8.3 پشتیبانی می کند. ( AOSP/2715214 )

نسخه 1.2.0-beta04

23 آگوست 2023

androidx.benchmark:benchmark-*:1.2.0-beta04 منتشر می شود. نسخه 1.2.0-beta04 شامل این تعهدات است.

ویژگی های جدید

  • افزونه Gradle Profile Profile اکنون از افزونه Android Gradle 8.3 پشتیبانی می کند. ( AOSP/2715214 )

رفع اشکال

  • خرابی ها را در نوشتن / جابجایی و کشیدن پرونده ها (به ویژه آنهایی که از تست های پارامتر شده) با استفاده از نام های بیشتر پرونده های خروجی ، جلوگیری از "=" و ":" در نام پرونده های خروجی را برطرف کنید. ( i759d8 )

نسخه 1.2.0-beta03

9 آگوست 2023

androidx.benchmark:benchmark-*:1.2.0-beta03 منتشر می شود. نسخه 1.2.0-beta03 شامل این تعهدات است.

تغییرات API

  • استدلال اضافه شده برای فیلتر کردن TraceSectionMetric به تنها بسته هدف ، به طور پیش فرض ( IA219B ، B/292208786 )

رفع اشکال

  • تغییر نام نامگذاری fullTracing.enable Argrentation به perfettoSdkTracing.enable برای سازگاری با نام مصنوعات و سایر منابع. fullTracing.enable به عنوان یک بازگشت به کار خود ادامه خواهد داد. ( i7cc00 )
  • کتابخانه معیار کتابخانه های داخلی (از جمله ردیابی حلقه/فاز میکروب "در حال حاضر در سیستم استودیو ردیابی بیننده و لانه تحت فرآیند صحیح در Perfetto ظاهر می شود. ( i6b2e7 ، b/293510459 )
  • ماکروبنچارک را حذف نکرد و خطای قابل استفاده در API 31+ را حذف کرد ، و از بررسی های قابل استفاده در دستگاه های ریشه دار Eng/UserDebug استفاده کنید. ( i2abac ، b/291722507 )
  • هنگام استفاده از بهینه سازی طرح DEX ، قوانین پروفایل راه اندازی نیز اکنون به عنوان قوانین مشخصات پایه در نظر گرفته می شوند. ( AOSP/2684246 ، B/293889189 )

نسخه 1.2.0-beta02

26 جولای 2023

androidx.benchmark:benchmark-*:1.2.0-beta02 منتشر می شود. نسخه 1.2.0-beta02 شامل این تعهدات است.

تغییرات API

  • API های تجربی برای معیارهای سفارشی میکروبن و پیکربندی اضافه شده (به عنوان مثال پروفایل و ردیابی). ( i86101 ، b/291820856 )

رفع اشکال

  • گزارش خطای گزارش در Macrobench هنگامی که سیستم عامل برای ردیابی نادرست است ، همانطور که اخیراً در شبیه سازهای API 26/28 ARM64 ثابت شده است. ( i0a328 ، b/282191686 )
  • جزئیات اضافه شده برای تنظیم مجدد تنظیم مجدد در پیشنهاد به روزرسانی شبیه ساز ، زیرا برخی از شبیه سازان اخیراً این مسئله را برطرف کرده اند. ( i8c815 ، b/282191686 )
  • androidx.test.uiautomator:uiautomator:2.2.0 api را به جای وابستگی implementation . ( i1981e )

نسخه 1.2.0-beta01

18 جولای 2023

androidx.benchmark:benchmark-*:1.2.0-beta01 منتشر می شود. نسخه 1.2.0-beta01 شامل این تعهدات است.

رفع اشکال

  • هشدارها را که گاهی اوقات در خروجی معیار در استودیو سرکوب می شود ، و راه حل های پیشرو در محل های سفید از خروجی معیار که در استودیو نشان داده نمی شود ( IA61D0 ، B/227205461 ، B/286306579 ، B/285912360 )
  • نظر ثابت برای FrameTimingMetric . زیرمجموعه نامگذاری frameDurationCpuMs است. ( IB097F ، B/288830934 ).

نسخه 1.2.0-alpha16

21 ژوئن 2023

androidx.benchmark:benchmark-*:1.2.0-alpha16 منتشر می شود. نسخه 1.2.0-alpha16 شامل این تعهدات است.

تغییرات API

  • BaselineProfileRule.collectBaselineProfile() API به BaselineProfileRule.collect() تغییر نام داده است. ( i4b665 )

رفع اشکال

  • پشتیبانی Macrobenchmark برای androidx.benchmark.profiling.mode = MethodTracing . ( i7ad37 ، b/285912360 )
  • پروفایل میکروبچارک به یک مرحله جداگانه منتقل شد ، بنابراین به جای تعویض آن ، پس از اندازه گیری به صورت توالی رخ می دهد. در صورت وجود ، بخش های ردیابی MethodTracing نیز در حال حاضر در ردیابی Perfetto ضبط شده گنجانده شده است. ( i9f657 ، b/285014599 )
  • اندازه گیری شمارش را به TraceSectionMetric با Mode.Sum اضافه کنید. ( IC121A ، B/264398606 )

نسخه 1.2.0-alpha15

7 ژوئن 2023

androidx.benchmark:benchmark-*:1.2.0-alpha15 منتشر می شود. نسخه 1.2.0-alpha15 شامل این تعهدات است.

ویژگی های جدید

  • برای ردیابی استفاده از حافظه از یک برنامه هدف MemoryUsageMetric تجربی اضافه شده است. ( i56453 ، b/133147125 ، b/281749311 )
  • پشتیبانی از پیکربندی های کاملاً سفارشی Perfetto را با PerfettoTrace.record ( IF9D75 ، B/280460183 ) اضافه کنید
  • ملک اضافه شده به تولید مشخصات پایه. استفاده ./gradlew assemble -Pandroidx.baselineprofile.skipgeneration ( i37fda ، b/283447020 )

تغییرات API

  • API collectBaselineProfile همیشه پروفایل های پایه پایدار تولید می کند. API collectStableBaselineProfile برداشته شده است و به جای آن باید از collectBaselineProfile استفاده شود. ( I17262 ، b/281078707 )
  • filterPredicate BaselineProfileRule تغییر یافته به غیر تهی ، با یک مقدار پیش فرض معادل آن به طوری که رفتار فیلتر پیش فرض در اسناد واضح تر است. ( i3816e )

رفع اشکال

  • غیرفعال کردن IsolationActivity و ردیابی Perfetto در dryRunMode برای بهبود چشمگیر عملکرد ، زیرا این اکثریت زمان اجرا بودند. ( IE4F7D )
  • پشتیبانی از نمونه گیری پشته تماس در ماکروبنچارک ها با استفاده از آرگومان های تست ابزار دقیق androidx.benchmark.profiling.mode=StackSampling و androidx.benchmark.profiling.sampleFrequency . ( i1d13b ، b/282188489 )
  • هنگام رها کردن سایه بان ها در Android U (API 34) و همچنین در شبیه سازها ، تصادف را برطرف می کند. ( I031CA ، B/274314544 )

نسخه 1.2.0-alpha14

3 مه 2023

androidx.benchmark:benchmark-*:1.2.0-alpha14 منتشر می شود. نسخه 1.2.0-alpha14 شامل این تعهدات است.

رفع اشکال

  • فریم های FrameTimingMetric با شناسه های فریم متناقض برطرف کنید. این امر باعث می شود برخی از انیمیشن ها در نسخه های پلت فرم اخیر (API 31+) بسیاری از فریم ها را نادیده بگیرند در حالی که RenderThread انیمیشن بود (به عنوان مثال در طول موج). ( i747d2 ، b/279088460 )
  • تجزیه و تحلیل پردازنده ردیابی ثابت برای اثری بزرگتر از 64 مگابایت. ( IEF831 ، B/269949822 )
  • تولید پروفایل پایه ثابت در Android U به دلیل خروجی مختلف دستور pm dump-profiles . ( ID1392 ، B/277645214 )
  • اسکریپت قفل ساعت GPU را برای مقایسه صحیح رشته ها برطرف کنید ( I53E54 ، B/213935715 )

نسخه 1.2.0-alpha13

5 آوریل 2023

androidx.benchmark:benchmark-*:1.2.0-alpha13 منتشر می شود. نسخه 1.2.0-alpha13 شامل این تعهدات است.

تغییرات API

  • پارامتر نوع پروفایل اضافه شده هنگام تولید پروفایل های پایه برای پشتیبانی از ویژگی پروفایل راه اندازی آینده ( IE20D7 ، B/275093123 )
  • اضافه شده API TraceMetric آزمایشی جدید برای تعریف معیارهای کاملاً سفارشی بر اساس محتوای اثری از پرفلتو. ( i4ce31 ، b/219851406 )
  • برای تعیین تعداد گسل های صفحه در طی یک معیار ، یک متریک آزمایشی اضافه کنید. ( i48db0 )

نسخه 1.2.0-alpha12

22 مارس 2023

androidx.benchmark:benchmark-*:1.2.0-alpha12 منتشر می شود. نسخه 1.2.0-alpha12 شامل این تعهدات است.

ویژگی های جدید

  • افزونه جدید Profile Profile Gradle در نسخه Alpha منتشر می شود و تولید یک پروفایل پایه و ساده سازی گردش کار توسعه دهنده را آسان تر می کند.

تغییرات API

  • پشتیبانی از ردیابی پرفراتو را در API 21 و 22 حذف کرد ، که شامل هر دو میکروب مارک ها و API های PerfettoTrace تجربی است. قبل از این نسخه ، اتصالات UiAutomation در برخی از دستگاه ها غیرقابل اعتماد بود. ( i78e8c )
  • API تجربی عمومی اضافه شده برای PerfettoTraceProcessor برای فعال کردن محتوای ردیابی تجزیه و تحلیل. این گامی به سوی معیارهای کاملاً سفارشی مبتنی بر داده های ردیابی Perfetto است. ( i2659e ، b/219851406 )

نسخه 1.2.0-alpha11

8 مارس 2023

androidx.benchmark:benchmark-*:1.2.0-alpha11 منتشر می شود. نسخه 1.2.0-alpha11 شامل این تعهدات است.

رفع اشکال

  • تصادفات ثابت در MacrobenchmarkRule و BaselineProfileRule هنگام نصب مجدد یا استخراج پروفایل از یک بسته نرم افزاری برنامه با APK های متعدد. ( I0D8C8 ، B/270587281 )

نسخه 1.2.0-alpha10

22 فوریه 2023

androidx.benchmark:benchmark-*:1.2.0-alpha10 منتشر می شود. نسخه 1.2.0-alpha10 شامل این تعهدات است.

ویژگی های جدید

  • در Android 14+ ، Macrobenchmark دیگر به لطف ویژگی جدید پلت فرم ، دیگر برنامه های هدف را برای تنظیم مجدد وضعیت تدوین نصب نمی کند. پیش از این لازم بود که یک دستگاه ریشه دار داشته باشید ، یا مقابله با تمام حالت برنامه (به عنوان مثال ورود کاربر) قبل از اجرای هر معیار حذف شود. ( i9b08c ، b/249143766 )

رفع اشکال

  • به دلیل پرش از تدوین ، DryRunMode با مشخصات خالی دیگر خراب نکنید. در عوض ، یک تکرار واحد را اجرا می کند و نمایه را برای اطمینان از اسیر چیزی استخراج می کند. ( I2F05D ، B/266403227 )
  • هنگام بررسی حضور PowerStats در سطح API قدیمی ، تصادف PowerMetric برطرف کنید. ( 5FAAF9 ، B/268253898 )

نسخه 1.2.0-alpha09

11 ژانویه 2023

androidx.benchmark:benchmark-*:1.2.0-alpha09 منتشر می شود. نسخه 1.2.0-alpha09 شامل این تعهدات است.

رفع اشکال

  • فعال کردن None به androidx.benchmark.enabledRules Arg Arg برای غیرفعال کردن همه معیارها / تولید مشخصات پایه. ( i3d7fd ، b/258671856 )
  • ضبط PerfettoTrace در ماژول های برنامه (یعنی APK های آزمایش غیر شخصی سازی) ( I12CFC )
  • مشخصات پایه ثابت ADB سفارش آرگومان در خروجی استودیو ( I958D1 ، B/261781624 )
  • ARM Emulator API 33 اکنون هنگام تلاش برای اجرای یک ماکروبچارک به درستی به عنوان چنین شناخته شده است و هشدار را به درستی چاپ می کند. ( 69133b ، b/262209591 )
  • بررسی سطح باتری در دستگاههای بدون باتری در ماکروبنچارک ( FE4114 ، B/232448937 )

نسخه 1.2.0-alpha08

7 دسامبر 2022

androidx.benchmark:benchmark-*:1.2.0-alpha08 منتشر می شود. نسخه 1.2.0-alpha08 شامل این تعهدات است.

تغییرات API

  • اضافه شده APIS جدید PerfettoTrace.record {} و PerfettoTraceRule برای ضبط آثار perfetto (که به عنوان آثار سیستم نیز شناخته می شود) به عنوان بخشی از یک آزمایش ، برای بازرسی از رفتار و عملکرد آزمون. ( i3ba16 )
  • BaselineProfileRule اکنون به جای لیستی از پیشوندهای بسته ، یک محمول فیلتر را می پذیرد. این کار کنترل کامل را در زمینه فیلتر فراهم می کند. ( i93240 )
  • یک API تجربی BaselineProfileRule.collectStableBaselineProfile اضافه کنید. ( i923f3 )
  • هنگام تولید پروفایل های پایه با استفاده از BaselineProfileRule ، امکان مشخص کردن پیشوند نام پرونده خروجی را اضافه کنید. ( i7b59f ، b/260318655 )

رفع اشکال

  • ایمنی نوشتن خروجی فایل را بهبود بخشید ، که باید از عدم نوشتن / ضمیمه شدن پرونده های خروجی جلوگیری کند ، به خصوص در API 21/22. ( IF8C44 ، B/227510293 )
  • برای ایجاد و قرار دادن صحیح فایل ، خروجی ردیابی simpleperf را برطرف کنید. این همچنین باید به طور کلی مواردی را که یک پرونده به طور ناموفق توسط Gradle کشیده می شود ، برطرف کند. ( i12a1c ، b/259424099 )
  • بهبود پیام خطای ProfileInstaller چاپ شده هنگامی که ProfileInstaller خیلی قدیمی است. این اکنون به شما می گوید نسخه ProfileInstaller (1.2.1) را برای اندازه گیری پروفایل های پایه در API 31 تا 33 به روز کنید ، به جای اینکه بگویید پشتیبانی نمی شود. ( IA517F ، B/253519888 )
  • چندین خرابی فرمان پوسته را برطرف کنید چاپ پیام ONERROR مورد نیاز API <= 23 ، از جمله تنظیمات باینری ضبط پرفلات و خرابی ضبط ردیابی ( IB6B87 ، B/258863685 )
  • به طور خودکار قوانین پروفایل تولید شده را مرتب کنید تا تعداد تغییرات را به حداقل برساند زیرا در طول زمان تغییر می کنند (هنگام بررسی قوانین نمایه در کنترل منبع). ( IE2509 )
  • تصادف ثابت در ساختهای Unooted در زیر Android 13 (API 33) با پیام Expected no stderr from echo 3 > /proc/sys/vm/drop_caches ( I6C245 ، B/259508183 )

مسائل شناخته شده - MacrobenchmarkScope.dropShaderCache() ممکن است به دلیل ثبت نام مفقود شده در مانیفست پروفایل ، که هنوز منتشر نشده است ، خراب شود. ( I5C728 ، B/258619948 ) برای حل مسئله در profileinstaller:1.3.0-alpha02 ، موارد زیر را به 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>

نسخه 1.2.0-alpha07

9 نوامبر 2022

androidx.benchmark:benchmark-*:1.2.0-alpha07 منتشر می شود. نسخه 1.2.0-alpha07 شامل این تعهدات است.

تغییرات API

  • API PowerMetric را برای اندازه گیری انرژی و قدرت در ماکروبچارک ها اضافه می کند. ( IFE601 ، B/220183779 )
  • ثابت MacrobenchmarkScope.dropShaderCache() برای رها کردن حافظه نهان سایه بان. این تقریباً 20 متر نویز از معیارهای StartupMode.COLD حذف می کند. پیش از این ، تدوین Partial با استفاده از تکرارهای گرمایش ، تعداد نادرست سریع را گزارش می کند ، زیرا ذخیره سازی سایه بان به احتمال زیاد در هنگام گرم شدن اتفاق می افتد. این رفع نیاز به یک دستگاه ریشه دار یا استفاده از profileinstaller:1.3.0-alpha02 در برنامه هدف. برای تغییرات API کتابخانه ProfileInstaller ، لطفاً به صفحه ProfileInstaller 1.30-Alpha02 مراجعه کنید. ( IA5171 ، B/231455742 )
  • اضافه شده TraceSectionMode("label", Mode.Sum) ، امکان اندازه گیری کل زمان صرف شده در بخش های چند ردیابی با همان برچسب را فراهم می کند. به عنوان مثال ، TraceSectionMetric("inflate", Mode.Sum) یک inflateMs معیار را برای کل زمان در یک ماکروبچارک صرف شده برای تورم گزارش می دهد. همچنین نیاز API 29 را حذف کرد ، زیرا TraceSectionMetric همراه با androidx.tracing.Trace به سطح API پایین تر ، با استفاده از forceEnableAppTracing در برنامه هدف ، بازگشت. ( id7b68 ، b/231455742 )

رفع اشکال

  • ایمنی بهبود یافته کلیه دستورات پوسته داخلی با اعتبارسنجی کلیه خروجی ها/خطاها. ( i5984d ، b/255402908 ، b/253094958 )
  • دستگاه را در مشخصات اولیه adb pull مشخص کنید ، بنابراین در صورت اتصال چندین دستگاه (حداکثر یک شبیه ساز) می توان دستور کشش را کپی کرد ( I6AC6C ، B/223359380 )
  • اگر APK Test Macrobenchmark به عنوان خود سازی تنظیم نشده باشد ، خطا را اضافه کنید. این خطا مانع از ورود ماکروبنچرم در فرآیند برنامه هدف می شود. در حال انجام ، Macrobench قادر به کامپایل/کشتن/سرماخوردگی برنامه نیست یا مجوزهای خود را کنترل می کند ( I4279B )
  • مسئله ای را در measureRepeated() که در آن راه StartupMode.COLD setupBlock برطرف می کند. اکنون setupBlock در تعامل با برنامه ، روند برنامه را اجرا نمی کند و اندازه گیری شروع سرما نامعتبر است. ( i8ebb7 )

نسخه 1.2.0-alpha06

24 اکتبر 2022

androidx.benchmark:benchmark-*:1.2.0-alpha06 منتشر می شود. نسخه 1.2.0-alpha06 شامل این تعهدات است.

تغییرات API

  • BaselineProfileRule دیگر نیازی به ریشه در اندروید 13 (API 33) ندارد و دیگر آزمایشی نیست. ( IE0A7D ، B/250083467 ، B/253094958 )
    • این تغییر همچنین چگونگی پروفایل های یک برنامه را به دیسک در دستگاه های بدون استفاده ، برطرف می کند ، اما نیاز به به روزرسانی وابستگی پروفایل برنامه هدف دارد.
    • برای استفاده از BaselineProfileRule یا CompilationMode.Partial(warmupIterations) در یک دستگاه بدون استفاده ، باید برنامه هدف خود را نیز به روز کنید تا از androidx.profileinstaller.profileinstaller:1.3.0-alpha01 . این امکان را می دهد تا نمایه را به درستی دیسک به درستی انجام دهد ، به طوری که می توان آن را گردآوری و استخراج کرد.

رفع اشکال

نسخه 1.2.0-alpha05

5 اکتبر 2022

androidx.benchmark:benchmark-*:1.2.0-alpha05 منتشر می شود. نسخه 1.2.0-alpha05 شامل این تعهدات است.

رفع اشکال

  • رفع خرابی قاب در سیستم استودیو ردیابی بیننده برای معیار آثار ضبط شده ( i3f3ae ، b/239677443 )
  • درست FrameTimingMetric برای لیست FrameOverrun به عنوان نیاز به API 31 به جای 29 ( I716DD ، B/220702554 )
  • تکرار را در BaselineProfileRule تنظیم کنید ، و اگر بسته هدف نصب نشده است (قبلاً برای macrobenchmarkrule انجام شده است) به وضوح پرتاب کنید. ( IC09A3 ، B/227991471 )

نسخه 1.2.0-alpha04

21 سپتامبر 2022

androidx.benchmark:benchmark-*:1.2.0-alpha04 منتشر می شود. نسخه 1.2.0-alpha04 شامل این تعهدات است.

ویژگی های جدید

  • برای توسعه سریع محلی و اعتبار سنجی اتوماسیون برنامه (به عنوان مثال در presubmit) ، پشتیبانی از dryRunMode.enable Argrentation را به macrobenchmark (که در حال حاضر در میکرو موجود است) اضافه کنید. این تکرار تکرار به 1 ، از تلفیق است ، همه خطاهای پیکربندی را سرکوب می کند و اندازه گیری خروجی فایل .json را غیرفعال می کند. ( IB51B4 ، b/175149857 )

    در خط فرمان Gradle:

    ./gradlew macrobenchmark:cC -P android.testInstrumentationRunnerArguments.androidx.benchmark.dryRunMode.enable=true
    

    در build.gradle:

    android {
        defaultConfig {
            testInstrumentationRunnerArgument 'androidx.benchmark.dryRunMode.enable', 'true'
        }
    }
    

رفع اشکال

  • StartupTimingMetric ثابت تا دیگر نیازی به فعالیت های اندازه گیری شده از طریق MacrobenchmarkScope.startActivityAndWait() . این بدان معناست که متریک می تواند پرتاب هایی را از EG اعلان ها ، Context.startActivity() ، ناوبری مبتنی بر فعالیت در برنامه یا دستورات پوسته انتخاب کند. ( IA2DE6 ، B/245414235 )
  • رفع اشکال در جایی که startActivityAndWait با کاهش سخت گیری در تشخیص قاب ، سعی در انتظار برای تکمیل راه اندازی بر روی شبیه سازها می کند. ( IBE2C6 ، B/244594339 ، B/228946895 )

نسخه 1.2.0-alpha03

7 سپتامبر 2022

androidx.benchmark:benchmark-*:1.2.0-alpha03 منتشر می شود. نسخه 1.2.0-alpha03 شامل این تعهدات است.

ویژگی های جدید

  • API های تجربی برای استفاده از BenchmarkState به طور مستقل ، جدا از BenchmarkRule / JUnit4 اضافه شد. ( id478f ، b/228489614 )

رفع اشکال

  • افزود: Leanback Backback برای startActivityAndWait . ( 01ed77 ، b/242899915 )

نسخه 1.2.0-alpha02

24 آگوست 2022

androidx.benchmark:benchmark-*:1.2.0-alpha02 منتشر می شود. نسخه 1.2.0-alpha02 شامل این تعهدات است.

تغییرات API

  • پیش فرض به am force stop برای MacrobenchmarkScope.killProcess() ، حتی اگر ریشه دار باشد ، به جز در طول تولید مشخصات پایه. این می تواند با یک استدلال بولی اختیاری نادیده گرفته شود. ( 02CCE9 ، b/241214097 )

رفع اشکال

  • پشتیبانی از تولید مشخصات پایه برای برنامه های سیستم. ( i900b8 ، b/241214097 )
  • پشتیبانی از معیارهای قدرت ODPM در دستگاه های بدون استفاده. ( A38C78 ، B/229623230 )

نسخه 1.2.0-alpha01

27 جولای 2022

androidx.benchmark:benchmark-*:1.2.0-alpha01 منتشر می شود. نسخه 1.2.0-alpha01 شامل این تعهدات است.

ویژگی های جدید

  • مؤلفه جدید ردیابی-پرفیتو-مشترک اجازه می دهد تا ابزارآلات Perfetto SDK را در برنامه ای که در معرض آن قرار دارد فعال کند ( I2CC7F )
  • androidx.benchmark.enabledRules Argertision Argertion برای فعال کردن فیلتر کردن ماکروبنچارک فقط به معیارها ، یا فقط تولید مشخصات پایه. در "macrobenchmark" یا "پایه profile" عبور کنید تا فقط یک نوع تست را اجرا کنید ، به عنوان مثال وقتی فقط BaselineProfiles روی یک شبیه ساز تولید می کنید. لیست جدا از کاما نیز پشتیبانی می کند. ( i756b7 ، b/230371561 )

    به عنوان مثال در ساخت Macrobenchmark خود. Gradle:

    android {
        defaultConfig {
            testInstrumentationRunnerArgument 'androidx.benchmark.enabledRules', 'BaselineProfile'
        }
    }
    

    یا از خط فرمان Gradle:

    ./gradlew macrobenchmark:cC -P android.testInstrumentationRunnerArguments.androidx.benchmark.enabledRules=BaselineProfile
    

تغییرات API

  • PowerMetric جدید برای اندازه گیری کارهای انرژی و قدرت در معیارها اضافه شده است. ( i9f39b ، b/220183779 )
  • اضافه کردن تنظیم مجدد و تدوین پروفایل ، یک مجموعه جدید CompilationMode.Ignore اضافه شده است. ( IBBCF8 ، B/230453509 )
  • یک پارامتر جدید به BaselineProfileRule#collectBaselineProfile برای فیلتر کردن پرونده خروجی توسط نام های بسته اضافه کرد ( IF7338 ، B/220146561 )
  • توسعه دهنده را قادر می سازد دستگاه را برای اندازه گیری تخلیه برق تخلیه کند. ( i6a6cb )
  • توانایی پاک کردن حافظه پنهان سایه بان در MacrobenchmarkScope را اضافه کرد. ( i32122 )
  • توسعه دهنده را قادر می سازد نمایشگر از نوع متریک و دسته بندی های زیر سیستم مورد نظر را پیکربندی کند. ( i810c9 )
  • پیش از این در صورت اجرای روی یک دستگاه پشتیبانی نشده ، در معیار پرتاب UnsupportedOperationException بود. اکنون UOE فقط در صورت استفاده از متریک در دستگاه پشتیبانی نشده (IE: PowerMetric.configure ) اتفاق می افتد. ( i5cf20 ، b/227229375 )
  • برای اندازه گیری قدرت و انرژی کل در هر دسته از سیستم در ماکروبنچرم ها ، TotalPowerMetric و TotalEnergyMetric اضافه شده است. ( i3b26b ، b/224557371 )

رفع اشکال

  • مسئله ای را برطرف کرد که روشهای کامپایل شده به درستی بین هر ماکروبچارک در ساختهای بدون استفاده مجدداً تنظیم نشده بود. این متأسفانه نیاز به نصب مجدد هر تکرار APK دارد ، که داده های کاربردی را برای هر ماکروبنچارک پاک می کند. ( i31c74 ، b/230665435 )
  • رفع ردیابی سقوط در API 21/22 ( IF7FD6 ، B/227509388 ، B/227510293 ، B/227512788 )
  • تشخیص راه اندازی فعالیت تعمیرات اساسی برای رفع "عدم توانایی خواندن هرگونه معیارها" در ماکروبنومرهای راه اندازی. ( IA517C )

نسخه 1.1.1

نسخه 1.1.1

9 نوامبر 2022

androidx.benchmark:benchmark-*:1.1.1 منتشر می شود. نسخه 1.1.1 شامل این تعهدات است.

رفع اشکال

  • android.system.ErrnoException: open failed: EACCES که در برخی از دستگاه های Android11 ​​(API 30)+ رخ می دهد. این یک انتخاب گیلاس یک رفع از 1.2.0-alpha01 است. ( AOSP/2072249 )

نسخه 1.1.0

نسخه 1.1.0

15 ژوئن 2022

androidx.benchmark:benchmark-*:1.1.0 منتشر می شود. نسخه 1.1.0 شامل این تعهدات است.

  • این نسخه با androidx.benchmark:benchmark-*:1.1.0-rc03 .

تغییرات مهم از 1.0.0

نسخه 1.1.0-RC03

1 ژوئن 2022

androidx.benchmark:benchmark-*:1.1.0-rc03 منتشر می شود. نسخه 1.1.0-RC03 شامل این تعهدات است.

رفع اشکال

  • از نصب مجدد بسته هدف در هر تکرار معیار خودداری کنید. ( AOSP/2093027 ، B/231976084 )

  • تأخیر 300ms را از pressHome() حذف کنید. ( AOSP/2086030 ، B/231322975 )

  • با بهینه سازی دستورات پوسته مورد استفاده در زیر کاپوت ، سرعت تکرار ماکروبنچارک را بهبود بخشید. ( aosp/2086023 , b/231323582 )

  • Support for Managed Gradle Devices when generating Baseline Profiles with Macrobenchmarks. ( aosp/2062228 , b/228926421 )

Version 1.1.0-rc02

11 مه 2022

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 CompilationMode having 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=false
    
  • Made it possible to share a module between macrobenchmarks and baseline profile generating tests by adding androidx.benchmark.enabledRules instrumentation argument. Pass in 'Macrobenchmark', or 'BaselineProfile' to just run one type of test, eg when generating BaselineProfiles on 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
    

نسخه 1.1.0-rc01

20 آوریل 2022

androidx.benchmark:benchmark-*:1.1.0-rc01 is released. نسخه 1.1.0-RC01 شامل این تعهدات است.

رفع اشکال

  • 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

6 آوریل 2022

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 than Compilation.None() . ( 611ac9 ).

Version 1.1.0-beta05

23 مارس 2022

androidx.benchmark:benchmark-*:1.1.0-beta05 is released. Version 1.1.0-beta05 contains these commits.

رفع اشکال

نسخه 1.1.0-beta04

23 فوریه 2022

androidx.benchmark:benchmark-*:1.1.0-beta04 is released. نسخه 1.1.0-beta04 شامل این تعهدات است.

رفع اشکال

  • Fix missing metrics on Android 10, and NoSuchElementException caused by process names not being captured correctly in traces. ( Ib4c17 , b/218668335 )

  • Use PowerManager for 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 measureRepeated thread 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 of androidx.profileinstaller and Android Gradle Plugin. aosp/1977029

نسخه 1.1.0-beta03

9 فوریه 2022

androidx.benchmark:benchmark-*:1.1.0-beta03 is released. نسخه 1.1.0-beta03 شامل این تعهدات است.

تغییرات API

  • Added AudioUnderrunMetric into macrobenchmark library under experimental flag to allow detection of audio underruns ( Ib5972 )
  • BaselineProfileRule no longer accepts a setup block as this functioned the same as the profileBlock . ( Ic7dfe , b/215536447 )

    برای مثال

    @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 -> FrameDurationUi to clarify these are durations, not timestamps, and to match prefixes. ( I0eba3 , b/216337830 )

نسخه 1.1.0-beta02

26 ژانویه 2022

androidx.benchmark:benchmark-*:1.1.0-beta02 is released. نسخه 1.1.0-beta02 شامل این تعهدات است.

رفع اشکال

  • 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 pull command in logcat and Studio output for pulling generated BaselineProfile text file. ( f08811 )

نسخه 1.1.0-beta01

12 ژانویه 2022

androidx.benchmark:benchmark-*:1.1.0-beta01 is released. نسخه 1.1.0-beta01 شامل این تعهدات است.

رفع اشکال

  • Fixes profiler argument enable being ignored. ( I37373 , b/210619998 )
  • Removed deprecated CompliationModes ( I98186 , b/213467659 )
  • Switched baseline profile arg of CompilationMode.Partial to enum for clarity. ( Id67ea )

Version 1.1.0-alpha13

15 دسامبر 2021

androidx.benchmark:benchmark-*:1.1.0-alpha13 is released. Version 1.1.0-alpha13 contains these commits.

تغییرات API

  • 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.Trace or androidx.tracing Jetpack 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 CompilationModes into 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 null in certain warmup scenarios). ( Id3b68 , b/208357448 , b/208369635 )

رفع اشکال

  • Fixed CompilationMode.Speed incorrectly treated as None ( I01137 )

Version 1.1.0-alpha12

17 نوامبر 2021

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

3 نوامبر 2021

androidx.benchmark:benchmark-*:1.1.0-alpha11 is released. Version 1.1.0-alpha11 contains these commits.

تغییرات API

  • Macrobenchmark now has a minSdkVersion of 23 . ( If2655 )
  • Adds a new experimental BaselineProfileRule which 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

27 اکتبر 2021

androidx.benchmark:benchmark-*:1.1.0-alpha10 is released. Version 1.1.0-alpha10 contains these commits.

تغییرات API

  • 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

13 اکتبر 2021

androidx.benchmark:benchmark-*:1.1.0-alpha09 is released. Version 1.1.0-alpha09 contains these commits.

رفع اشکال

Version 1.1.0-alpha08

29 سپتامبر 2021

androidx.benchmark:benchmark-*:1.1.0-alpha08 is released. Version 1.1.0-alpha08 contains these commits.

تغییرات API

  • 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

1 سپتامبر 2021

androidx.benchmark:benchmark-*:1.1.0-alpha07 is released. Version 1.1.0-alpha07 contains these commits.

تغییرات API

  • 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 ProfileInstaller to make it easier for apps using baseline profiles to run MacroBenchmarks using CompilationMode.BaselineProfile . ( I42657 , b/196074999 ) NOTE: requires also updating to androidx.profileinstaller:profileinstaller:1.1.0-alpha04 or greater.
  • StartupMode.COLD + CompilationMode.None benchmarks are now more stable. ( I770cd , b/196074999 )

نسخه 1.1.0-alpha06

18 آگوست 2021

androidx.benchmark:benchmark-*:1.1.0-alpha06 is released. نسخه 1.1.0-alpha06 شامل این تعهدات است.

تغییرات API

  • Added androidx.benchmark.iterations instrumentation 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.BaselineProfile is a work in progress. Avoid using it to determine how good a profile is for now.

نسخه 1.1.0-alpha05

4 آگوست 2021

androidx.benchmark:benchmark-*:1.1.0-alpha05 is released. نسخه 1.1.0-alpha05 شامل این تعهدات است.

1.1.0-alpha04 was cancelled before release due to a sporatic crash. b/193827052

تغییرات API

  • 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 EmptyActivity to bring the target app out of a force-stopped state to better support CompilationMode.BaselineProfile . ( Id7cac , b/192084204 )
  • Changed trace file extension to .perfetto-trace to 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 )

نسخه 1.1.0-alpha03

16 ژوئن 2021

androidx.benchmark:benchmark-*:1.1.0-alpha03 is released. نسخه 1.1.0-alpha03 شامل این تعهدات است.

ویژگی های جدید

رفع اشکال

  • 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.

    به عنوان مثال،

    testInstrumentationRunnerArguments["androidx.benchmark.suppressErrors"] = "EMULATOR,LOW-BATTERY"
    

نسخه 1.1.0-alpha02

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. نسخه 1.1.0-alpha02 شامل این تعهدات است.

ویژگی های جدید

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 )

نسخه 1.1.0-alpha01

10 ژوئن 2020

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. نسخه 1.1.0-alpha01 شامل این تعهدات است.

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:
    • testBuildType is 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.debug is 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 InstrumentationResultParser error 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.

نسخه 1.0.0

Benchmark Version 1.0.0

20 نوامبر 2019

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 .

ویژگی های اصلی 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

نسخه 1.0.0-RC01

23 اکتبر 2019

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

نسخه 1.0.0-beta01

9 اکتبر 2019

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. نسخه 1.0.0-beta01 حاوی این تعهدات است .

ویژگی های جدید

  • 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-lint dependency, 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 additionalTestOutputDir instrumentation 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

18 سپتامبر 2019

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 تغییر می کند

  • The experimental annotation ExperimentalAnnotationReport is now correctly public. Usage of the experimental BenchmarkState#report API now requires this annotation

نسخه 1.0.0-alpha05

5 سپتامبر 2019

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. commit های موجود در این نسخه را می توانید در اینجا بیابید.

API تغییر می کند

  • BenchmarkState.reportData API is now marked experimental

رفع اشکال

  • Fix for the clock-locking script, which would fail on devices that were either missing the cut or expr shell utilities.
  • Fixed an issue with ./gradlew lockClocks task that would hang on devices that were rooted with an older version of the su utility, which did not support the -c flag.

نسخه 1.0.0-alpha04

7 آگوست 2019

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. commit های موجود در این نسخه را می توانید در اینجا بیابید.

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
    • Now automatically disables test coverage, and sets the AndroidBenchmarkRunner by default ( b/138374050 )
    • Added support for new AGP-based data copy, when running benchmarks and when using AGP 3.6+
  • JSON format additions
    • Output total benchmark test run time ( b/133147694 )
    • @Parameterized benchmarks 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 تغییر می کند

  • Module structure has changed, splitting the library ( b/138451391 )
    • benchmark:benchmark-junit4 contains classes with JUnit dependency: AndroidBenchmarkRunner , and BenchmarkRule , both of which have moved into the androidx.benchmark.junit4 package
    • benchmark:benchmark-common contains 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

کمک های خارجی

  • Thanks to Sergey Zakharov for contributing JSON output improvements and the fix for screen off issues!

Version 1.0.0-alpha03

2 جولای 2019

androidx.benchmark:benchmark:1.0.0-alpha03 and androidx.benchmark:benchmark-gradle-plugin:1.0.0-alpha03 are released. commit های موجود در این نسخه را می توانید در اینجا بیابید.

ویژگی های جدید

  • 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

نسخه 1.0.0-alpha02

6 ژوئن 2019

androidx.benchmark:1.0.0-alpha02 and androidx.benchmark:benchmark-gradle-plugin:1.0.0-alpha02 are released. commit های موجود در این نسخه را می توانید در اینجا بیابید.

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 تغییر می کند

  • 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.reportData API ( b/132887006 )

رفع اشکال

  • Fixed ./gradlew lockClocks not sticking on some recent OS devices ( b/133424037 )
  • Throttling detection disabled for emulator ( b/132880807 )

نسخه 1.0.0-alpha01

7 مه 2019

androidx.benchmark:benchmark:1.0.0-alpha01 is released. The commits included in this version are available here .

،

معیار

Accurately measure your code's performance within Android Studio.
آخرین به روز رسانی انتشار پایدار کاندید را آزاد کنید نسخه بتا انتشار آلفا
9 آوریل 2025 1.3.4 - - 1.4.0-alpha11

اعلام وابستگی ها

To add a dependency on Benchmark, you must add the Google Maven repository to your project. برای اطلاعات بیشتر، مخزن Maven Google را بخوانید.

Macrobenchmark

To use Macrobenchmark in your project, add the following dependencies to your build.gradle file for your macrobenchmark module :

شیار

dependencies {
  androidTestImplementation "androidx.benchmark:benchmark-macro-junit4:1.3.4"
}

کاتلین

dependencies {
  androidTestImplementation("androidx.benchmark:benchmark-macro-junit4:1.3.4")
}

Microbenchmark

To use Microbenchmark in your project, add the following dependencies to your build.gradle file for your microbenchmark module :

شیار

dependencies {
    androidTestImplementation "androidx.benchmark:benchmark-junit4:1.3.4"
}

android {
    ...
    defaultConfig {
        ...
        testInstrumentationRunner "androidx.benchmark.junit4.AndroidBenchmarkRunner"
    }
}

کاتلین

dependencies {
    androidTestImplementation("androidx.benchmark:benchmark-junit4:1.3.4")
}

android {
    ...
    defaultConfig {
        ...
        testInstrumentationRunner = "androidx.benchmark.junit4.AndroidBenchmarkRunner"
    }
}

کتابخانه Microbenchmark همچنین یک پلاگین Gradle را برای استفاده با ماژول microbenchmark ارائه می دهد. این افزونه پیش‌فرض‌های پیکربندی ساخت را برای ماژول تنظیم می‌کند، نسخه خروجی معیار را برای میزبان تنظیم می‌کند و وظیفه ./gradlew lockClocks را ارائه می‌کند.

برای استفاده از این افزونه، خط زیر را در بلوک «plugins» در فایل build.gradle سطح بالای خود قرار دهید:

شیار

plugins {
  id 'androidx.benchmark' version '1.3.4' apply false
}

کاتلین

plugins {
  id("androidx.benchmark") version "1.3.4" apply false
}

سپس افزونه را در فایل build.gradle ماژول بنچمارک خود اعمال کنید

شیار

plugins {
  id 'androidx.benchmark'
}

کاتلین

plugins {
    id("androidx.benchmark")
}

بازخورد

بازخورد شما به بهتر شدن Jetpack کمک می کند. اگر مسائل جدیدی کشف کردید یا ایده هایی برای بهبود این کتابخانه دارید، به ما اطلاع دهید. لطفاً قبل از ایجاد کتابخانه جدید، به مسائل موجود در این کتابخانه نگاهی بیندازید. با کلیک کردن روی دکمه ستاره می توانید رای خود را به یک موضوع موجود اضافه کنید.

یک شماره جدید ایجاد کنید

برای اطلاعات بیشتر به مستندات ردیاب مشکل مراجعه کنید.

نسخه 1.4

Version 1.4.0-alpha11

9 آوریل 2025

androidx.benchmark:benchmark-*:1.4.0-alpha11 is released. Version 1.4.0-alpha11 contains these commits .

تغییرات API

  • Changed TraceProcessor 's argument timeout: Duration to timeoutMs long for Java caller usability. ( I9fbb5 )
  • Mark TraceProcessor constructor as internal. Callers should use TraceProcessor.startServer or TraceProcessor.runServer . ( Ia8c5b )

رفع اشکال

  • When killing the application with MacrobenchmarkScope.killProcess , validate the kill command results to prevent silent failure, and timeout error. ( I84555 )

به روز رسانی های وابستگی

  • This library now targets Kotlin 2.0 language level and requires KGP 2.0.0 or newer. ( Idb6b5 )

Version 1.4.0-alpha10

26 مارس 2025

androidx.benchmark:benchmark-*:1.4.0-alpha10 is released. Version 1.4.0-alpha10 contains these commits .

تغییرات API

  • Increased default timeout for TraceProcessor server load and querying to 120 seconds (from 60/30 previously), and made both configurable with one timeout parameter. ( Ifec87 )

رفع اشکال

  • Fixed a few issues that would occur when benchmarking or capturing profiles of an app without profileinstaller , and it's included BroadcastReciever . This only affects runs on rooted devices. ( Ied308 )

Version 1.4.0-alpha09

12 مارس 2025

androidx.benchmark:benchmark-*:1.4.0-alpha09 is released. Version 1.4.0-alpha09 contains these commits .

تغییرات API

  • Added TraceProcessor and Session API with closable Handles, for easier usage with custom lifecycles. This is also a step towards enabling easier Coroutine and Java API usage. The extension functions to TraceProcessor.runServer {} are now marked experimental, as they're likely to move, and be made non-experimental in the future. ( I358b4 )

رفع اشکال

  • Fixed Benchmark and Baseline Profile capture not working with API 36 due to a change in pgrep toybox that now requires -a to print the full command line. ( Idc991 )
  • Filter default tracing config to reduce risk of data loss in traces on newer API levels. ( I54e8a )
  • Added experimental androidx.benchmark.killExistingPerfettoRecordings instrumentation argument, which can be set to false to allow pre existing perfetto trace capture to continue. By default pre existing perfetto trace captures on device are killed to prevent interference. ( I02a3c )
  • The JSON field context.osCodenameAbbreviated will now be REL for released OS versions at and above API 35, as non-numeric code names are no longer supported by the underlying platform. ( Ib17fd )
  • Fixes crash in FrameTimingMetric when resynced frames occur. ( I7c6f4 , b/394610806 )
  • No longer assume Choreographer#doFrame is the top of the stack frame on the main thread for FrameTimingQuery . ( Iee0e0 , b/340206285 )

Version 1.4.0-alpha08

12 فوریه 2025

androidx.benchmark:benchmark-*:1.4.0-alpha08 is released. Version 1.4.0-alpha08 contains these commits .

تغییرات API

  • Moved TraceProcessor.runSession() extension APIs to be experimental, as they are likely to move to be concrete constructors eventually on Android. ( Ib0528 , b/393640753 )
  • Most of the implementation of Startup Insights are now public/experimental, and move to the TraceProcessor artifact See StartupInsights . ( I0aa00 )
  • Deprecate BenchmarkRule.runWithTimingDisabled {} in favor of BenchmarkRule.runWithMeasurementDisabled {} , which more clearly describes the behavior - all metrics are paused. Additionally, expose the MicrobenchmarkScope superclass since redeclaring the runWithMeasurementDisabled function to open access isn't possible, since it's inline. ( I9e23b , b/389149423 , b/149979716 )
  • Benchmark libraries have moved to Kotlin 2.0. ( I9d1e0 )
  • Removed androidx.benchmark.startupProfiles.enable instrumentation argument. It is no longer useful, as it can be controlled by includeInStartupProfile arg in BaselineProfileRule.collect() . ( I39eb4 )

رفع اشکال

  • Reduced the amount of Microbenchmark internal functions called during profiling to make eg Method traces more clear ( Ifaed8 )
  • Speculative fix for crashes: 'Failed to stop [ ProcessPid(processName=perfetto, pid=...) ]'. Now Benchmark will log a message instead of crashing when a background Perfetto process isn't able to be stopped before running the benchmark. ( I37d3e , b/323601788 )
  • Fix IllegalStateExceptions with 'Expected pm dump-profiles stdout' label that were caused by overly strict output format check. ( I358dc )

Version 1.4.0-alpha07

29 ژانویه 2025

androidx.benchmark:benchmark-*:1.4.0-alpha07 is released. Version 1.4.0-alpha07 contains these commits .

ویژگی های جدید

  • BaselineProfileRule now introduces a collectWithResults(...) API which includes a list of paths to the computed profiles. ( I056f8 )
  • Added androidx.benchmark.measureRepeatedOnMainThread.throwOnDeadline instrumentation argument, which can be set to false to disable the throw on deadline behavior of measureRepeatedOnMainThread for local testing. Not otherwise recommended, as this increases the likelihood of ANRs during tests. ( Idbeec , b/353226476 )

تغییرات API

  • Added @JvmOverloads to MicrobenchmarkConfig constructor. ( I13fd3 )
  • Refactored BenchmarkRule to be built on top of coroutines, and support better yield() behavior. This refactor removed several experimental BenchmarkState APIs, but will be followed by replacements as needed. Additionally, added runWithMeasurementDisabled to clarify behavior (all measurement is paused). In the future, runWithTimingDisabled will be deprecated. ( I19837 , b/389149423 , b/311242861 )
  • Move PerfettoTraceProcessor to TraceProcessor in a new androidx.benchmark:benchmark-traceprocessor artifact, and make most of its API non-experimental. Any custom TraceMetric or anything reading from traces will need to update to the new TraceProcessor import. The new TraceProcessor API works exactly like the old one, but is a standalone interface library (somewhat analogous to the androidx.sqlite layer from Room) with an Android-specific implementation built into macrobenchmark. The new artifact can be used on JVM as well, but currently you'll need to start your own copy of the TraceProcessor binary and offer a port to connect to it on. ( I3a767 , I62563 , b/381134564 )

رفع اشکال

  • Throw a clearer error message when MacrobenchmarkScope.startActivityAndWait fails to launch the target process (potentially due to a crash in the target process), instead of the more ambiguous 'Unable to confirm activity launch completion' message ( I3539b )
  • Fixed several syntax errors in Kotlin samples, and syntax highlighting in several Java / build.gradle samples. ( Ib3808 )
  • Clarified ArtMetric and CaptureInfo parameter docs. ( I96e60 )

Version 1.4.0-alpha06

11 دسامبر 2024

androidx.benchmark:benchmark-*:1.4.0-alpha06 is released. Version 1.4.0-alpha06 contains these commits .

تغییرات API

  • Removed usage of @Language("sql") in PerfettoTraceProcessor.Session.query() , as Studio highlighting/parsing is broken. ( Idc2fa , b/377733398 )

رفع اشکال

  • این کتابخانه اکنون از حاشیه‌نویسی‌های پوچ JSpecify استفاده می‌کند که نوع استفاده هستند. Kotlin developers should use the following compiler arguments to enforce correct usage: -Xjspecify-annotations=strict , -Xtype-enhancement-improvements-strict-mode ( I46810 , b/326456246 )
  • Corrected ArtMetric to report class load (not init), and improved docs to clarify runtime behavior. ( I9915c )
  • On Android Multiuser, execute commands as root only on rooted devices. ( I88b44 )

نسخه 1.4.0-alpha05

13 نوامبر 2024

androidx.benchmark:benchmark-*:1.4.0-alpha05 is released. Version 1.4.0-alpha05 contains these commits .

رفع اشکال

  • Fixed an issue on API 34+ where CompilationMode.None() would have inconsistent performance not representative of initial, worst case performance. This works around a platform change which allows ART's compilation state verify to partially compile apps (only affecting class loading) shortly after first launch. ( Ie48d0 )
  • Fixed issue where (especially short) traces could be captured that wouldn't report measurement from built-in Macrobenchmark Metrics, due to the process name being truncated within the Perfetto trace. Now macrobenchmark works around this issue by looking for the truncated package name in all built-in queries, in addition to the expected package name. Note that custom TraceMetric implementations or other direct callers of PerfettoSession.query can implement this same behavior by changing process.name LIKE "$packageName" in a Perfetto query to instead be (process.name LIKE "$packageName" OR process.name LIKE "$(packageName.takeLast(15))") . ( I5bf01 , b/377565760 )

نسخه 1.4.0-alpha04

30 اکتبر 2024

androidx.benchmark:benchmark-*:1.4.0-alpha04 is released. Version 1.4.0-alpha04 contains these commits .

ویژگی های جدید

  • (Experimental) Enable Baseline Profile generation, and benchmarking on apps installed to a secondary user, for example any app on headless Android Auto devices. This support has been tested in some scenarios, but let us know with a bug if it doesn't work for you. ( I9fcbe , b/356684617 , b/373641155 )

رفع اشکال

  • isProfileable is now always overridden in benchmark builds, and isDebuggable is also now always overridden in both benchmark and nonMinified (baseline profile capture) builds. ( I487fa , b/369213505 )
  • Fixes compilation detection on some physical devices prior to API 28 - affects json context.compilationMode , as well as behavior of androidx.benchmark.requireAot=true (which no longer incorrectly throws) ( Ic3e08 , b/374362482 )
  • In CpuEventCounter metrics, throw if invalid measurements are observed (eg instructions/cpucycles==0) ( I8c503 )

نسخه 1.4.0-alpha03

16 اکتبر 2024

androidx.benchmark:benchmark-*:1.4.0-alpha03 is released. Version 1.4.0-alpha03 contains these commits .

تغییرات API

  • Macrobenchmark : Adds ArtMetric , which can be used to inspect profile coverage or general Android RunTime performance. Captures number and total duration of JIT, class init (where available), and class verification. Additionally, changes CaptureInfo to include optional ART mainline version with default. ( I930f7 )
  • Add coefficientOfVariation to Benchmark JSON output to show stability within a given benchmark run. ( Ib14ea )

رفع اشکال

  • Fixed CollectBaselineProfileTask when AVD device has spaces in it. ( Ia0225 , b/371642809 )
  • Speculative fix for errors from StartupMode.COLD exceptions: Package <packagename> must not be running prior to cold start! . Now, MacrobenchmarkScope.killProcess() (including the one run before each iteration, used to implement StartupMode.COLD behavior) will wait to verify that the app's processes have all stopped running. ( I60aa6 , b/351582215 )
  • Fixed issue where UNLOCKED_ error would show up on some rooted emulators. ( Ic5117 )
  • این کتابخانه اکنون از حاشیه‌نویسی‌های پوچ JSpecify استفاده می‌کند که نوع استفاده هستند. Kotlin developers should use the following compiler arguments to enforce correct usage: -Xjspecify-annotations=strict , -Xtype-enhancement-improvements-strict-mode ( I7104f , b/326456246 )

نسخه 1.4.0-alpha02

2 اکتبر 2024

androidx.benchmark:benchmark-*:1.4.0-alpha02 is released. Version 1.4.0-alpha02 contains these commits .

تغییرات API

  • Moved Gradle tasks lockClocks and unlockClocks to be on benchmark projects, instead of available at the top level. This change was necessary as there is unfortunately no way to register these as top level actions without breaking project isolation. ( I02b8f , b/363325823 )

رفع اشکال

  • BaselineProfileRule now collects profiles for multi-process apps by signaling each running process at the end of the block to dump profiles. If a profile based compilation never successfully finds a process to broadcast to, the compilation will fail, as it's unexpected to have profile data within. Additionally, added an instrumentation argument to control dump wait duration: androidx.benchmark.saveProfileWaitMillis ( I0f519 , b/366231469 )
  • From Benchmark 1.3.2 : Fixed Firebase Test Lab (FTL) being unable to pull Baseline Profile or Macrobenchmark result files from the Baseline Profile Gradle Plugin. ( I2f678 , b/285187547 )

To use FTL apply the plugin to the baseline profile module in the plugin block, with:

  plugins {
      ...
      id("com.google.firebase.testlab")
  }

and then configure firebase test lab with:

  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}")
          }
      }
  }

Also the created FTL device needs to be added to the baseline profile extension:

  baselineProfile {
      managedDevices += "ftlDeviceShiba34"
      useConnectedDevices = false
  }

نسخه 1.4.0-alpha01

18 سپتامبر 2024

androidx.benchmark:benchmark-*:1.4.0-alpha01 is released. Version 1.4.0-alpha01 contains these commits .

New Feature - App Startup Insights

  • Initial version of app startup insights can be enabled in Macrobenchmark. ( 09fae38 )

To enable in a startup benchmark:

  @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(...)
      }
  }

Then running your startup benchmark will analyze the trace to look for common problems, and print them after metrics to Studio test output in the benchmark tab, eg:

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

This feature is still a work-in-progress, with improvements to documentation and extensibility to follow, but feedback is welcome.

ویژگی های جدید

  • Added gradle property androidx.baselineprofile.suppressWarnings to suppress all baseline profile warnings. ( 314153a )
  • Microbench metrics are now displayed in Perfetto traces as counters. ( 3214854 )
  • Add experimental scripts for disabling jit (requires root / runtime restart), and resetting device perf/test state. These are not currently published as gradle tasks. ( 7c3732b )
  • Added benchmark argument to skip tests when running on emulator. When automaticGenerationDuring build is enabled, benchmarks will also trigger baseline profile generation. This will fail, if emulators are used. With the new argument skipBenchmarksOnEmulator we can instead skip the test. ( 0c2ddcd )
  • Change perf event enable logic to run on API 23+ ( 2550048 )

تغییرات API

  • Existing experimental PerfettoConfig argument to MacrobenchmarkRule.measureRepeated() moved to the new ExperimentalConfig object.

رفع اشکال

  • Increase lockClocks.sh retry count ( 99e9dac )
  • Don't create nonMinified and benchmark build types if existing. Due to a bug, even if nonMinified and benchmark build types existed, they were going to be recreated. ( e75f0a5 )
  • Ignore non-terminating slices from TraceSectionMetric results. ( a927d20 )
  • Improved emulator check to consider sdk_ prefix. ( 1587de8 )
  • Treat non-running packages as cleared in FrameTimingGfxInfoMetric . ( 35cc79c )
  • Fix androidx.benchmark.cpuEventCounter producing corrupt values for non-Instruction events. ( 06edd59 )
  • Fix resumeTiming/runWithTimingDisabled to respect metric priority order, and significantly reduce impact of lower priority metric pause/resume on higher priority metric results. For example, if using cpu perf counters via cpuEventCounter.enable instrumentation argument, timeNs is no longer significantly reduced when pause/resume occur. ( 5de0968 )

نسخه 1.3

نسخه 1.3.4

26 مارس 2025

androidx.benchmark:benchmark-*:1.3.4 is released. Version 1.3.4 contains these commits .

رفع اشکال

  • Fixed Gradle Project Isolation incompatibilities in the Benchmark Baseline Gradle Plugin. ( b/404523257 )

نسخه 1.3.3

16 اکتبر 2024

androidx.benchmark:benchmark-*:1.3.3 is released. Version 1.3.3 contains these commits .

رفع اشکال

  • Fixed CollectBaselineProfileTask when AVD device has spaces in it ( Ia0225 , b/371642809 )

نسخه 1.3.2

2 اکتبر 2024

androidx.benchmark:benchmark-*:1.3.2 is released. Version 1.3.2 contains these commits .

رفع اشکال

  • Fixed Firebase Test Lab (FTL) being unable to pull Baseline Profile or Macrobenchmark result files from the Baseline Profile Gradle Plugin. ( I2f678 , b/285187547 )

To use FTL apply the plugin to the baseline profile module in the plugin block, with:

  plugins {
      ...
      id("com.google.firebase.testlab")
  }

and then configure firebase test lab with:

  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}")
          }
      }
  }

Also the created FTL device needs to be added to the baseline profile extension:

  baselineProfile {
      managedDevices += "ftlDeviceShiba34"
      useConnectedDevices = false
  }

نسخه 1.3.1

18 سپتامبر 2024

androidx.benchmark:benchmark-*:1.3.1 is released. Version 1.3.1 contains these commits .

رفع اشکال

  • Added gradle property androidx.baselineprofile.suppressWarnings to suppress all baseline profile warnings ( I7c36e , b/349646646 )
  • Fixed Baseline Profile Gradle Plugin to use pre-existing nonMinified… and benchmark… if created by the app instead of creating wrappers. ( Ia8934 , b/361370179 )
  • Fixed java.lang.AssertionError: ERRORS (not suppressed): EMULATOR when automaticGenerationDuringBuild is enabled on emulators. New argument is used to instead skip the test. ( If3f51 , b/355515798 )
  • Microbenchmark minification - keep subclasses of org.junit.runner.notification.RunListener in benchmark library proguard ( Ic8ed5 , b/354264743 )
  • Fix TraceSectionMetric to Ignore non-terminating slices. Previously these were considered to have -1 duration, eg during summation or finding minimum duration. ( If74b7 )
  • Fixed an issue in FrameTimingGfxInfoMetric where starting the metric would crash if the process wasn't already running. ( I6e412 )

نسخه 1.3.0

21 آگوست 2024

androidx.benchmark:benchmark-*:1.3.0 is released. Version 1.3.0 contains these commits .

Microbenchmark changes since 1.2.0

  • Method tracing is on by default in microbenchmarks when running on most devices
    • Method tracing runs as a separate phase, after measurements - this enables accurate measurements and method traces to both be output from a single benchmark run
    • Method tracing on some Android OS and ART versions will affect later measurement phases - on these versions, method tracing is off by default and a warning is printed to Studio output
  • Main thread benchmarks and ANRs
    • Added measureRepeatedOnMainThread for UI thread benchmarks (eg those that interact with Compose/View UIs) to avoid ANRs when running for many seconds.
    • Method traces are skipped if expected to overrun the ANR avoidance deadline. Set androidx.benchmark.profiling.skipWhenDurationRisksAnr to false to disable this behavior (not recommended for CI runs, as ANRs can cause problem in long CI runs).
  • کوچک سازی
    • Embedded proguard rules to improve microbenchmarking with minification enabled
    • Minification/R8 in a library module requires AGP 8.3, and can be enabled via android.buildTypes.release.androidTest.enableMinification in your build.gradle
    • Experimental BlackHole.consume() API added to prevent dead code elimination ( If6812 , b/286091643 )
  • معیارها
    • Experimental cpu event counter feature (metrics from perf_event_open , which requires root on most versions of the platform), access via InstrumentationArgument androidx.benchmark.cpuEventCounter.enable (can be set to true ), and androidx.benchmark.cpuEventCounter.events can be set eg to ( Instructions,CpuCycles ). This should be supported on some userdebug emulators, but support has not been tested across all available emulators

MACRObenchmark changes since 1.2.0

  • Method tracing overhaul for macrobenchmarks.
    • Now method traces are scoped to the duration of the measureBlock , and can capture multiple sessions if the process starts multiple times.
    • Previously, method tracing would only work for StartupMode.COLD benchmarks, and capture nothing for measureBlocks that didn't restart the target process
    • Fixed method traces flush in macrobenchmark, so that method traces should be fully captured and valid, even on slower devices. ( I6349a , b/329904950 )
  • Correctly dump ART profile during individual warmUp iterations when process is killed so CompilationMode.Partial(warmup=N) measurements are more accurate. ( I17923 )
  • Drop Shader broadcast failure message
    • Added debugging suggestions to drop shader broadcast failure message
    • Add two instrumentation arguments for overriding shader dropping behavior to workaround crashes when benchmarking apps without ProfileInstaller 1.3:
      • androidx.benchmark.dropShaders.enable=true/false : can be used to skip all shader dropping (including that done in StartupMode.Cold launches), 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 )
  • Added experimental MacrobenchmarkRule#measureRepeated variant which takes a custom PerfettoConfig for fully customized Perfetto trace recording. Note that incorrectly configured configs may cause built in Metric classes to fail. ( Idfd3d , b/309841164 , b/304038384 )
  • Cancel background dexopt jobs before running a Macrobenchmark to reduce interference. ( I989ed )
  • Macrobenchmark now waits for 1 second for the target application to flush an ART profile (previously it waited for 500 ms). ( I85a50 , b/316082056 )
  • TraceSectionMetric overhaul
    • Note : TraceSectionMetric changes below can affect outputs in CI usage, and may create discontinuities, or break parsing
    • Sum is now the default, as most usage of this metric is for repeated events, and first would discard data in these cases
    • Changed to be more customizable, with more available modes
    • Mode names are now embedded in metric output name (in Studio and JSON)
    • Now supports slices created using Trace.{begin|end}AsyncSection .
  • معیارها
    • Power - Added PowerMetric.deviceSupportsHighPrecisionTracking , PowerMetric.deviceBatteryHasMinimumCharge() and PowerMetric.deviceSupportsPowerEnergy()
    • Renamed Metric.getResult to getMeasurements to match return type
    • 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 )
    • Added frameCount measurement to FrameTimingMetric to aid in discovery of scenarios where measurements change because the number of frames produced changed (new animations added, invalidation issues fixed). ( I1e5aa )
    • Clarified that frameOverrunMs is the preferred metric for tracking when available in docs, and why. ( I18749 , b/329478323 )
    • 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 )
    • Improve FrameTimingMetric error when frames aren't produced, and always output link to trace when failing metric parsing to assist in diagnosing problem. ( I956b9 )
    • Fixed crash in FrameTimingMetric failing 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 )

Baseline Profile capture / Gradle plugin changes since 1.2.0

  • Increased max recommended version of AGP to 9.0.0-alpha01.
  • Ensure mergeArtProfile and mergeStartupProfile tasks always wait for baseline profile generation. ( I623d6 , b/343086054 )
  • Generating a baseline profile successfully will output a summary of what changed ( I824c8 , b/269484510 )
  • Added DSL to disable warnings ( Ic4deb , b/331237001 )
  • Fix to ensure benchmarks use generated baseline profiles when automaticGenerationDuringBuild is off ( Ic144f , b/333024280 )
  • Fix BaselineProfile gradle plugin property overrides to enable baseline profile generation and benchmarking when customizing a nonMinified or benchmark build type. ( Ib8f05 , b/324837887 )
  • 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 )

Other significant changes since 1.2.0

  • Trace capture
    • Reduced EXITCODE 2 error when starting perfetto from an error to logged warning
    • Enable AIDL tracing by default in benchmarks(requires API 28) ( Ia0af2 , b/341852305 )
    • Enable porter tag tracing by default in benchmarks. This captures, for example, wakelock tracepoints. ( Icfe44 , b/286551983 )
    • Increased trace capture start timeout to avoid crashes when starting tracing on slower devices ( I98841 , b/329145808 )
    • Added public API PerfettoTraceProcessor.Session.queryMetrics APIs with JSON, textproto, and proto binary (undecoded) variants. These allow you to query metrics built into TraceProcessor ( I54d7f , b/304038382 )
    • 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 )
  • خروجی JSON
    • 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 - Equals android.os.Build.ID
      • context.build.version.codename - Equals android.os.Build.VERSION.CODENAME
      • context.build.version.abbreviatedCodename - corresponds to first letter of pre-release codename (including on release builds) ( Ie5020 )
    • Added profilerOutput list to JSON output for easier tooling around profiling traces (eg Perfetto, Method traces) ( I05ddd , b/332604449 )
    • 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 )
    • Throw when filenames are longer than 200 chars to avoid unclear crashes when writing or post-processing files. ( I4a5ab )

نسخه 1.3.0-RC01

7 آگوست 2024

androidx.benchmark:benchmark-*:1.3.0-rc01 is released. Version 1.3.0-rc01 contains these commits .

رفع اشکال

  • Fix androidx.benchmark.cpuEventCounter producing corrupt values for non-Instruction events ( I7386a , b/286306579 )
  • Fix resumeTiming / runWithTimingDisabled to respect metric priority order, and significantly reduce impact of lower priority metric pause/resume on higher priority metric results. For example, if using cpu perf counters via cpuEventCounter.enable instrumentation argument, timeNs is no longer significantly reduced when pause/resume occur. ( I39c2e , b/286306579 , b/307445225 )
  • Reduced chance of stack sampling causing measureRepeatedOnMainThread from hitting main thread hard timeout by moving stack sampling conversion off main thread. ( I487a8 , b/342237318 )
  • Removed manual outlining of access to new platform APIs since this happens automatically via API modeling when using R8 with AGP 7.3 or later (eg R8 version 3.3) and for all builds when using AGP 8.1 or later (eg D8 version 8.1). Clients who are not using AGP are advised to update to D8 version 8.1 or later. برای جزئیات بیشتر به این مقاله مراجعه کنید. ( 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 )

نسخه 1.3.0-beta02

10 جولای 2024

androidx.benchmark:benchmark-*:1.3.0-beta02 is released. Version 1.3.0-beta02 contains these commits .

رفع اشکال

  • Gracefully handle EXITCODE 2 when starting Perfetto to log a warning, but proceed.

نسخه 1.3.0-beta01

12 ژوئن 2024

androidx.benchmark:benchmark-*:1.3.0-beta01 is released. Version 1.3.0-beta01 contains these commits .

تغییرات API

  • Renamed MethodTracing.affectsMeasurementOnThisDevice to AFFECTS_MEASUREMENT_ON_THIS_DEVICE for 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 via ProfilerConfig.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 - Equals android.os.Build.ID
    • context.build.version.codename - Equals android.os.Build.VERSION.CODENAME
    • context.build.version.abbreviatedCodename - corresponds to first letter of pre-release codename (even on release builds) ( Ie5020 )
  • Fixes StackSampling to respect androidx.benchmark.profiling.sampleDurationSeconds ( Ib1d53 )
  • Change macro->common dependency to be api() , so it's easier to use eg PerfettoTrace and PerfettoConfig . ( Icdae3 , b/341851833 )
  • Ensure mergeArtProfile and mergeStartupProfile tasks 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

14 مه 2024

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

1 مه 2024

androidx.benchmark:benchmark-*:1.3.0-alpha04 is released. Version 1.3.0-alpha04 contains these commits .

تغییرات API

  • Added experimental MacrobenchmarkRule#measureRepeated variant which takes a custom PerfettoConfig for 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.deviceSupportsPowerEnergy to PowerMetric.deviceSupportsHighPrecisionTracking for clarity ( I5b82f )
  • Added PowerMetric.deviceBatteryHasMinimumCharge() and PowerMetric.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 )

نسخه 1.3.0-alpha03

17 آوریل 2024

androidx.benchmark:benchmark-*:1.3.0-alpha03 is released. Version 1.3.0-alpha03 contains these commits .

ویژگی های جدید

  • Adds public API PerfettoTraceProcessor.Session.queryMetrics APIs with JSON, textproto, and proto binary (undecoded) variants. These allow you to query metrics built into TraceProcessor ( I54d7f , b/304038382 )
  • Added profilerOutput to 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

  • Changed TraceSectionMetric.Mode to sealed class to enable future expansion without breaking exhaustive when statements ( I71f7b )
  • Added TraceSectionMetric.Mode.Average and .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.getResult to getMeasurements to match return type ( I42595 )

رفع اشکال

  • Fix to ensure benchmarks use generated baseline profiles when automaticGenerationDuringBuild is off ( Ic144f , b/333024280 )
  • Fix BaselineProfile gradle plugin property overrides to enable baseline profile generation and benchmarking when customizing a nonMinified or 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 )
  • TraceSectionMetric now supports slices created using Trace.{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 frameCount measurement to FrameTimingMetric to aid in discovery of scenarios where measurements change because the number of frames produced changed (new animations added, invalidation issues fixed). ( I1e5aa )
  • Clarified that frameOverrunMs is the preferred metric for tracking when available in docs, and why. ( I18749 , b/329478323 )

نسخه 1.3.0-alpha02

20 مارس 2024

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 )

نسخه 1.3.0-alpha01

21 فوریه 2024

androidx.benchmark:benchmark-*:1.3.0-alpha01 is released. نسخه 1.3.0-alpha01 شامل این تعهدات است.

تغییرات API

  • Renamed MicrobenchmarkConfig boolean parameters to avoid unnecessary word 'should' ( Ia8f00 , b/303387299 )
  • Added BenchmarkRule.measureRepeatedOnMainThread so 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 of FrameTimingMetric with 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 warmUp iterations. ( I17923 )
  • Several changes to TraceSectionMetric API:
    • 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 )

رفع اشکال

  • 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 ProfileInstaller 1.3:
    • androidx.benchmark.dropShaders.enable=true/false : can be used to skip all shader dropping (including that done in StartupMode.Cold launches), 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 verification on 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-stop to kill apps when not a system app like System UI or Launcher. ( I5e028 )
  • Macrobenchmark now waits for 1 second for the target application to flush an ART profile (previously it waited for 500 ms ). ( I85a50 , b/316082056 )
  • Improve FrameTimingMetric error when frames aren't produced, and always output link to trace when failing metric parsing to assist in diagnosing problem. ( I956b9 )
  • Fixed crash in FrameTimingMetric failing 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 )

نسخه 1.2

نسخه 1.2.4

17 آوریل 2024

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 automaticGenerationDuringBuild in libraries causing a circular dependency. ( I28ab7 , b/333024280 )
  • Use am force-stop to kill apps when not a system app like System UI or Launcher. This fixes StartupMode.COLD benchmarks crashing from "Package $package must not be running prior to cold start!" due to process kill not fully succeeding. ( I5e028 )

نسخه 1.2.3

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.

نسخه 1.2.2

1 دسامبر 2023

androidx.benchmark:benchmark-*:1.2.2 is released. Version 1.2.2 contains these commits.

Baseline Profiles

نسخه 1.2.1

15 نوامبر 2023

androidx.benchmark:benchmark-*:1.2.1 is released. نسخه 1.2.1 شامل این تعهدات است.

ویژگی های جدید

نسخه 1.2.0

18 اکتبر 2023

androidx.benchmark:benchmark-*:1.2.0 is released. نسخه 1.2.0 شامل این تعهدات است.

تغییرات مهم از 1.1.0

Baseline Profiles

  • New Baseline Profile Gradle Plugin automates capturing and including baseline profiles in your test and build workflow.
  • BaselineProfileRule.collect now stable, a streamlined and simplified version of the previous experimental BaselineProfileRule.collectBaselineProfile API
    • Just specify packageName , and drive your app
  • For libraries generating baseline profiles, you can now filter the rules generated either in code ( BaselineProfileRule.collect argument), or even more simply in the gradle plugin
  • رفع می کند

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.enable instrumentation argument, (already available in microbenchmark) for quicker validation runs (eg when creating the benchmark, or in presubmit)
    • Support for androidx.benchmark.profiling.mode=StackSampling and MethodTracing .
    • Added androidx.benchmark.enabledRules to allow runtime filtering baseline profile vs macrobenchmark rule tests
    • Added androidx.benchmark.perfettoSdkTracing.enable argument to enable tracing with tracing-perfetto, eg Compose recomposition tracing. Note that when used with StartupMode.COLD , timing will be significantly affected as the tracing library is loaded and enabled during app startup.
  • الزامات

    • Macrobenchmark now requires ProfileInstaller 1.3.0 or greater in the target app, to enable profile capture / reset, and shader cache clearing.
  • New Experimental Metric APIs

  • رفع می کند

    • Fixed crashes when installing or extracting profiles from an app installed from multiple APKs (eg from app bundle).
    • Fixed FrameTimingMetric ignoring 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.COLD by consistently dropping the shader cache (also exposed via MacrobenchmarkScope.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.
  • APIهای آزمایشی
    • Added experimental MicrobenchmarkConfig API 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 BenchmarkState separately from BenchmarkRule , without JUnit
    • Added experimental PerfettoTrace record to enable capturing Perfetto traces, with custom configuration, separate from benchmark APIs.
  • رفع می کند
    • Workaround missing leading whitespaces in Android Studio benchmark output.
    • Fix issue where warnings could fail to print in Android Studio benchmark output.
    • Fixed SampledProfiling crash on Android 13 (API 33) and higher.
    • Massively improved performance of dryRunMode by skipping IsolationActivity and Perfetto tracing (Up to 10x faster dry run mode on older OS versions).

نسخه 1.2.0-RC02

6 اکتبر 2023

androidx.benchmark:benchmark-*:1.2.0-rc02 is released. نسخه 1.2.0-RC02 شامل این تعهدات است.

رفع اشکال

  • Fix Benchmark file output to no longer break BaselineProfile Plugin 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-perfetto loading error messages when injecting from macrobenchmark module into target application.

نسخه 1.2.0-RC01

20 سپتامبر 2023

androidx.benchmark:benchmark-*:1.2.0-rc01 is released. نسخه 1.2.0-RC01 شامل این تعهدات است.

رفع اشکال

  • 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

30 آگوست 2023

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

23 آگوست 2023

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 )

نسخه 1.2.0-beta03

9 آگوست 2023

androidx.benchmark:benchmark-*:1.2.0-beta03 is released. نسخه 1.2.0-beta03 شامل این تعهدات است.

تغییرات API

  • Added argument to filter TraceSectionMetric to only the target package, on by default ( Ia219b , b/292208786 )

رفع اشکال

  • Renamed fullTracing.enable instrumentation argument to perfettoSdkTracing.enable for consistency with artifact name, and other references. fullTracing.enable will 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 )

نسخه 1.2.0-beta02

26 جولای 2023

androidx.benchmark:benchmark-*:1.2.0-beta02 is released. نسخه 1.2.0-beta02 شامل این تعهدات است.

تغییرات API

  • 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.0 an api instead of an implementation dependency. ( I1981e )

نسخه 1.2.0-beta01

18 جولای 2023

androidx.benchmark:benchmark-*:1.2.0-beta01 is released. نسخه 1.2.0-beta01 شامل این تعهدات است.

رفع اشکال

  • 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 named frameDurationCpuMs . ( Ib097f , b/288830934 ).

Version 1.2.0-alpha16

21 ژوئن 2023

androidx.benchmark:benchmark-*:1.2.0-alpha16 is released. Version 1.2.0-alpha16 contains these commits.

تغییرات API

  • BaselineProfileRule.collectBaselineProfile() API has been renamed to BaselineProfileRule.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. MethodTracing trace sections are also now included in the captured Perfetto trace, if present. ( I9f657 , b/285014599 )
  • Add count measurement to TraceSectionMetric with Mode.Sum . ( Ic121a , b/264398606 )

Version 1.2.0-alpha15

7 ژوئن 2023

androidx.benchmark:benchmark-*:1.2.0-alpha15 is released. Version 1.2.0-alpha15 contains these commits.

ویژگی های جدید

  • Added experimental MemoryUsageMetric for 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

  • The collectBaselineProfile API always generates stable baseline profiles. The collectStableBaselineProfile API has been removed and collectBaselineProfile should be used instead. ( I17262 , b/281078707 )
  • Changed BaselineProfileRule 's filterPredicate arg to non-null, with a equivalent default value so that the default filter behavior is more clear in docs. ( I3816e )

رفع اشکال

  • Disable IsolationActivity and Perfetto tracing in dryRunMode to 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=StackSampling and androidx.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

3 مه 2023

androidx.benchmark:benchmark-*:1.2.0-alpha14 is released. Version 1.2.0-alpha14 contains these commits.

رفع اشکال

  • Fix FrameTimingMetric ignoring frames with inconsistent frame IDs. This would cause some animations on recent platform versions (API 31+) to ignore many frames while RenderThread was 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-profiles command. ( Id1392 , b/277645214 )
  • Fix GPU clock locking script to compare strings correctly ( I53e54 , b/213935715 )

Version 1.2.0-alpha13

5 آوریل 2023

androidx.benchmark:benchmark-*:1.2.0-alpha13 is released. Version 1.2.0-alpha13 contains these commits.

تغییرات API

  • Added profile type parameter when generating baseline profiles to support upcoming startup profile feature ( Ie20d7 , b/275093123 )
  • Added new experimental TraceMetric API 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

22 مارس 2023

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

  • Removed Perfetto tracing support on API 21 and 22, which includes both Microbenchmarks and the experimental PerfettoTrace APIs. Prior to this version, UiAutomation connections were unreliable on some devices. ( I78e8c )
  • Added public experimental API for PerfettoTraceProcessor to 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

8 مارس 2023

androidx.benchmark:benchmark-*:1.2.0-alpha11 is released. Version 1.2.0-alpha11 contains these commits.

رفع اشکال

  • Fixed crashes in MacrobenchmarkRule and BaselineProfileRule when reinstalling or extracting profiles from an app bundle with multiple APKs. ( I0d8c8 , b/270587281 )

Version 1.2.0-alpha10

22 فوریه 2023

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 DryRunMode to 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 PowerMetric crash when checking for powerstats presence on old API levels. ( 5faaf9 , b/268253898 )

Version 1.2.0-alpha09

11 ژانویه 2023

androidx.benchmark:benchmark-*:1.2.0-alpha09 is released. Version 1.2.0-alpha09 contains these commits.

رفع اشکال

  • Enabled passing None to androidx.benchmark.enabledRules instrumentation arg to disable all benchmarks / baseline profile generation. ( I3d7fd , b/258671856 )
  • Fix PerfettoTrace capture 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 )

نسخه 1.2.0-alpha08

7 دسامبر 2022

androidx.benchmark:benchmark-*:1.2.0-alpha08 is released. نسخه 1.2.0-alpha08 شامل این تعهدات است.

تغییرات API

  • Added experimental new APIs PerfettoTrace.record {} and PerfettoTraceRule to capture Perfetto traces (also known as System Traces) as part of a test, to inspect test behavior and performance. ( I3ba16 )
  • BaselineProfileRule now 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.collectStableBaselineProfile which 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 simpleperf trace 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>

نسخه 1.2.0-alpha07

9 نوامبر 2022

androidx.benchmark:benchmark-*:1.2.0-alpha07 is released. نسخه 1.2.0-alpha07 شامل این تعهدات است.

تغییرات API

  • Adds PowerMetric API 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 from StartupMode.COLD benchmarks, as shaders are now consistently cleared each iteration. Previously, Partial compilation 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 using profileinstaller:1.3.0-alpha02 in the target app. For ProfileInstaller library'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 metric inflateMs for the total time in a macrobenchmark spent on inflation. Also removed API 29 requirement, as TraceSectionMetric works together with androidx.tracing.Trace back to lower API levels, with the use of forceEnableAppTracing within 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 pull command, 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() where StartupMode.COLD wouldn't kill the target process after setupBlock . Now setupBlock interacting with the app will not leave the app process running, and an invalid cold start measurement. ( I8ebb7 )

نسخه 1.2.0-alpha06

24 اکتبر 2022

androidx.benchmark:benchmark-*:1.2.0-alpha06 is released. نسخه 1.2.0-alpha06 شامل این تعهدات است.

تغییرات API

  • BaselineProfileRule no 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 BaselineProfileRule or CompilationMode.Partial(warmupIterations) on an unrooted device, you must also update your target app to use androidx.profileinstaller.profileinstaller:1.3.0-alpha01 . This enables flushing the profile to disk correctly, so that it can be compiled/extracted.

رفع اشکال

نسخه 1.2.0-alpha05

5 اکتبر 2022

androidx.benchmark:benchmark-*:1.2.0-alpha05 is released. نسخه 1.2.0-alpha05 شامل این تعهدات است.

رفع اشکال

  • Fix frame breakdown in Studio system trace viewer for benchmark captured traces ( I3f3ae , b/239677443 )
  • Correct FrameTimingMetric to list FrameOverrun as 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 )

نسخه 1.2.0-alpha04

21 سپتامبر 2022

androidx.benchmark:benchmark-*:1.2.0-alpha04 is released. نسخه 1.2.0-alpha04 شامل این تعهدات است.

ویژگی های جدید

  • Add support for dryRunMode.enable instrumentation 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=true
    

    In build.gradle:

    android {
        defaultConfig {
            testInstrumentationRunnerArgument 'androidx.benchmark.dryRunMode.enable', 'true'
        }
    }
    

رفع اشکال

  • Fixed StartupTimingMetric to no longer require measured Activities to be launched through MacrobenchmarkScope.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 startActivityAndWait would timeout trying to wait for launch completion on emulators by reducing strictness of frame detection. ( Ibe2c6 , b/244594339 , b/228946895 )

نسخه 1.2.0-alpha03

7 سپتامبر 2022

androidx.benchmark:benchmark-*:1.2.0-alpha03 is released. نسخه 1.2.0-alpha03 شامل این تعهدات است.

ویژگی های جدید

  • Added experimental APIs for using BenchmarkState independently, separate from BenchmarkRule / JUnit4 . ( Id478f , b/228489614 )

رفع اشکال

نسخه 1.2.0-alpha02

24 آگوست 2022

androidx.benchmark:benchmark-*:1.2.0-alpha02 is released. نسخه 1.2.0-alpha02 شامل این تعهدات است.

تغییرات API

  • Default to am force stop for MacrobenchmarkScope.killProcess() , even when rooted, except during Baseline Profile generation. This can be overridden with an optional boolean argument. ( 02cce9 , b/241214097 )

رفع اشکال

نسخه 1.2.0-alpha01

27 جولای 2022

androidx.benchmark:benchmark-*:1.2.0-alpha01 is released. نسخه 1.2.0-alpha01 شامل این تعهدات است.

ویژگی های جدید

  • New tracing-perfetto-common component allowing tooling to enable Perfetto SDK tracing in an app that exposes it ( I2cc7f )
  • Added androidx.benchmark.enabledRules instrumentation 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 generating BaselineProfiles on 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

  • Added new PowerMetric for measuring energy and power tasks in benchmarks. ( I9f39b , b/220183779 )
  • Added a new compilation mode CompilationMode.Ignore to skip profile reset and compilation. ( Ibbcf8 , b/230453509 )
  • Added a new parameter to BaselineProfileRule#collectBaselineProfile to 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 UnsupportedOperationException was 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 TotalPowerMetric and TotalEnergyMetric for 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 )

نسخه 1.1.1

نسخه 1.1.1

9 نوامبر 2022

androidx.benchmark:benchmark-*:1.1.1 is released. نسخه 1.1.1 شامل این تعهدات است.

رفع اشکال

  • Fixes android.system.ErrnoException: open failed: EACCES which would occur on some Android11 (API 30)+ devices. This is a cherry-pick of a fix from 1.2.0-alpha01 . ( aosp/2072249 )

نسخه 1.1.0

نسخه 1.1.0

15 ژوئن 2022

androidx.benchmark:benchmark-*:1.1.0 is released. نسخه 1.1.0 شامل این تعهدات است.

  • This version is identical to androidx.benchmark:benchmark-*:1.1.0-rc03 .

تغییرات مهم از 1.0.0

نسخه 1.1.0-RC03

1 ژوئن 2022

androidx.benchmark:benchmark-*:1.1.0-rc03 is released. نسخه 1.1.0-RC03 شامل این تعهدات است.

رفع اشکال

Version 1.1.0-rc02

11 مه 2022

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 CompilationMode having 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=false
    
  • Made it possible to share a module between macrobenchmarks and baseline profile generating tests by adding androidx.benchmark.enabledRules instrumentation argument. Pass in 'Macrobenchmark', or 'BaselineProfile' to just run one type of test, eg when generating BaselineProfiles on 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
    

نسخه 1.1.0-rc01

20 آوریل 2022

androidx.benchmark:benchmark-*:1.1.0-rc01 is released. نسخه 1.1.0-RC01 شامل این تعهدات است.

رفع اشکال

  • 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

6 آوریل 2022

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 than Compilation.None() . ( 611ac9 ).

Version 1.1.0-beta05

23 مارس 2022

androidx.benchmark:benchmark-*:1.1.0-beta05 is released. Version 1.1.0-beta05 contains these commits.

رفع اشکال

نسخه 1.1.0-beta04

23 فوریه 2022

androidx.benchmark:benchmark-*:1.1.0-beta04 is released. نسخه 1.1.0-beta04 شامل این تعهدات است.

رفع اشکال

  • Fix missing metrics on Android 10, and NoSuchElementException caused by process names not being captured correctly in traces. ( Ib4c17 , b/218668335 )

  • Use PowerManager for 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 measureRepeated thread 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 of androidx.profileinstaller and Android Gradle Plugin. aosp/1977029

نسخه 1.1.0-beta03

9 فوریه 2022

androidx.benchmark:benchmark-*:1.1.0-beta03 is released. نسخه 1.1.0-beta03 شامل این تعهدات است.

تغییرات API

  • Added AudioUnderrunMetric into macrobenchmark library under experimental flag to allow detection of audio underruns ( Ib5972 )
  • BaselineProfileRule no longer accepts a setup block as this functioned the same as the profileBlock . ( Ic7dfe , b/215536447 )

    برای مثال

    @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 -> FrameDurationUi to clarify these are durations, not timestamps, and to match prefixes. ( I0eba3 , b/216337830 )

نسخه 1.1.0-beta02

26 ژانویه 2022

androidx.benchmark:benchmark-*:1.1.0-beta02 is released. نسخه 1.1.0-beta02 شامل این تعهدات است.

رفع اشکال

  • 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 pull command in logcat and Studio output for pulling generated BaselineProfile text file. ( f08811 )

نسخه 1.1.0-beta01

12 ژانویه 2022

androidx.benchmark:benchmark-*:1.1.0-beta01 is released. نسخه 1.1.0-beta01 شامل این تعهدات است.

رفع اشکال

  • Fixes profiler argument enable being ignored. ( I37373 , b/210619998 )
  • Removed deprecated CompliationModes ( I98186 , b/213467659 )
  • Switched baseline profile arg of CompilationMode.Partial to enum for clarity. ( Id67ea )

Version 1.1.0-alpha13

15 دسامبر 2021

androidx.benchmark:benchmark-*:1.1.0-alpha13 is released. Version 1.1.0-alpha13 contains these commits.

تغییرات API

  • 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.Trace or androidx.tracing Jetpack 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 CompilationModes into 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 null in certain warmup scenarios). ( Id3b68 , b/208357448 , b/208369635 )

رفع اشکال

  • Fixed CompilationMode.Speed incorrectly treated as None ( I01137 )

Version 1.1.0-alpha12

17 نوامبر 2021

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

3 نوامبر 2021

androidx.benchmark:benchmark-*:1.1.0-alpha11 is released. Version 1.1.0-alpha11 contains these commits.

تغییرات API

  • Macrobenchmark now has a minSdkVersion of 23 . ( If2655 )
  • Adds a new experimental BaselineProfileRule which 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

27 اکتبر 2021

androidx.benchmark:benchmark-*:1.1.0-alpha10 is released. Version 1.1.0-alpha10 contains these commits.

تغییرات API

  • 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

13 اکتبر 2021

androidx.benchmark:benchmark-*:1.1.0-alpha09 is released. Version 1.1.0-alpha09 contains these commits.

رفع اشکال

Version 1.1.0-alpha08

29 سپتامبر 2021

androidx.benchmark:benchmark-*:1.1.0-alpha08 is released. Version 1.1.0-alpha08 contains these commits.

تغییرات API

  • 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

1 سپتامبر 2021

androidx.benchmark:benchmark-*:1.1.0-alpha07 is released. Version 1.1.0-alpha07 contains these commits.

تغییرات API

  • 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 ProfileInstaller to make it easier for apps using baseline profiles to run MacroBenchmarks using CompilationMode.BaselineProfile . ( I42657 , b/196074999 ) NOTE: requires also updating to androidx.profileinstaller:profileinstaller:1.1.0-alpha04 or greater.
  • StartupMode.COLD + CompilationMode.None benchmarks are now more stable. ( I770cd , b/196074999 )

نسخه 1.1.0-alpha06

18 آگوست 2021

androidx.benchmark:benchmark-*:1.1.0-alpha06 is released. نسخه 1.1.0-alpha06 شامل این تعهدات است.

تغییرات API

  • Added androidx.benchmark.iterations instrumentation 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.BaselineProfile is a work in progress. Avoid using it to determine how good a profile is for now.

نسخه 1.1.0-alpha05

4 آگوست 2021

androidx.benchmark:benchmark-*:1.1.0-alpha05 is released. نسخه 1.1.0-alpha05 شامل این تعهدات است.

1.1.0-alpha04 was cancelled before release due to a sporatic crash. b/193827052

تغییرات API

  • 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 EmptyActivity to bring the target app out of a force-stopped state to better support CompilationMode.BaselineProfile . ( Id7cac , b/192084204 )
  • Changed trace file extension to .perfetto-trace to 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 )

نسخه 1.1.0-alpha03

16 ژوئن 2021

androidx.benchmark:benchmark-*:1.1.0-alpha03 is released. نسخه 1.1.0-alpha03 شامل این تعهدات است.

ویژگی های جدید

رفع اشکال

  • 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.

    به عنوان مثال،

    testInstrumentationRunnerArguments["androidx.benchmark.suppressErrors"] = "EMULATOR,LOW-BATTERY"
    

نسخه 1.1.0-alpha02

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. نسخه 1.1.0-alpha02 شامل این تعهدات است.

ویژگی های جدید

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 )

نسخه 1.1.0-alpha01

10 ژوئن 2020

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. نسخه 1.1.0-alpha01 شامل این تعهدات است.

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:
    • testBuildType is 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.debug is 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 InstrumentationResultParser error 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.

نسخه 1.0.0

Benchmark Version 1.0.0

20 نوامبر 2019

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 .

ویژگی های اصلی 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

نسخه 1.0.0-RC01

23 اکتبر 2019

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

نسخه 1.0.0-beta01

9 اکتبر 2019

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. نسخه 1.0.0-beta01 حاوی این تعهدات است .

ویژگی های جدید

  • 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-lint dependency, 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 additionalTestOutputDir instrumentation 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

18 سپتامبر 2019

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 تغییر می کند

  • The experimental annotation ExperimentalAnnotationReport is now correctly public. Usage of the experimental BenchmarkState#report API now requires this annotation

نسخه 1.0.0-alpha05

5 سپتامبر 2019

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. commit های موجود در این نسخه را می توانید در اینجا بیابید.

API تغییر می کند

  • BenchmarkState.reportData API is now marked experimental

رفع اشکال

  • Fix for the clock-locking script, which would fail on devices that were either missing the cut or expr shell utilities.
  • Fixed an issue with ./gradlew lockClocks task that would hang on devices that were rooted with an older version of the su utility, which did not support the -c flag.

نسخه 1.0.0-alpha04

7 آگوست 2019

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. commit های موجود در این نسخه را می توانید در اینجا بیابید.

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
    • Now automatically disables test coverage, and sets the AndroidBenchmarkRunner by default ( b/138374050 )
    • Added support for new AGP-based data copy, when running benchmarks and when using AGP 3.6+
  • JSON format additions
    • Output total benchmark test run time ( b/133147694 )
    • @Parameterized benchmarks 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 تغییر می کند

  • Module structure has changed, splitting the library ( b/138451391 )
    • benchmark:benchmark-junit4 contains classes with JUnit dependency: AndroidBenchmarkRunner , and BenchmarkRule , both of which have moved into the androidx.benchmark.junit4 package
    • benchmark:benchmark-common contains 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

کمک های خارجی

  • Thanks to Sergey Zakharov for contributing JSON output improvements and the fix for screen off issues!

Version 1.0.0-alpha03

2 جولای 2019

androidx.benchmark:benchmark:1.0.0-alpha03 and androidx.benchmark:benchmark-gradle-plugin:1.0.0-alpha03 are released. commit های موجود در این نسخه را می توانید در اینجا بیابید.

ویژگی های جدید

  • 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

نسخه 1.0.0-alpha02

6 ژوئن 2019

androidx.benchmark:1.0.0-alpha02 and androidx.benchmark:benchmark-gradle-plugin:1.0.0-alpha02 are released. commit های موجود در این نسخه را می توانید در اینجا بیابید.

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 تغییر می کند

  • 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.reportData API ( b/132887006 )

رفع اشکال

  • Fixed ./gradlew lockClocks not sticking on some recent OS devices ( b/133424037 )
  • Throttling detection disabled for emulator ( b/132880807 )

نسخه 1.0.0-alpha01

7 مه 2019

androidx.benchmark:benchmark:1.0.0-alpha01 is released. The commits included in this version are available here .

،

معیار

Accurately measure your code's performance within Android Studio.
آخرین به روز رسانی انتشار پایدار کاندید را آزاد کنید نسخه بتا انتشار آلفا
9 آوریل 2025 1.3.4 - - 1.4.0-alpha11

اعلام وابستگی ها

To add a dependency on Benchmark, you must add the Google Maven repository to your project. برای اطلاعات بیشتر، مخزن Maven Google را بخوانید.

Macrobenchmark

To use Macrobenchmark in your project, add the following dependencies to your build.gradle file for your macrobenchmark module :

شیار

dependencies {
  androidTestImplementation "androidx.benchmark:benchmark-macro-junit4:1.3.4"
}

کاتلین

dependencies {
  androidTestImplementation("androidx.benchmark:benchmark-macro-junit4:1.3.4")
}

Microbenchmark

To use Microbenchmark in your project, add the following dependencies to your build.gradle file for your microbenchmark module :

شیار

dependencies {
    androidTestImplementation "androidx.benchmark:benchmark-junit4:1.3.4"
}

android {
    ...
    defaultConfig {
        ...
        testInstrumentationRunner "androidx.benchmark.junit4.AndroidBenchmarkRunner"
    }
}

کاتلین

dependencies {
    androidTestImplementation("androidx.benchmark:benchmark-junit4:1.3.4")
}

android {
    ...
    defaultConfig {
        ...
        testInstrumentationRunner = "androidx.benchmark.junit4.AndroidBenchmarkRunner"
    }
}

کتابخانه Microbenchmark همچنین یک پلاگین Gradle را برای استفاده با ماژول microbenchmark ارائه می دهد. این افزونه پیش‌فرض‌های پیکربندی ساخت را برای ماژول تنظیم می‌کند، نسخه خروجی معیار را برای میزبان تنظیم می‌کند و وظیفه ./gradlew lockClocks را ارائه می‌کند.

برای استفاده از این افزونه، خط زیر را در بلوک «plugins» در فایل build.gradle سطح بالای خود قرار دهید:

شیار

plugins {
  id 'androidx.benchmark' version '1.3.4' apply false
}

کاتلین

plugins {
  id("androidx.benchmark") version "1.3.4" apply false
}

سپس افزونه را در فایل build.gradle ماژول بنچمارک خود اعمال کنید

شیار

plugins {
  id 'androidx.benchmark'
}

کاتلین

plugins {
    id("androidx.benchmark")
}

بازخورد

بازخورد شما به بهتر شدن Jetpack کمک می کند. اگر مسائل جدیدی کشف کردید یا ایده هایی برای بهبود این کتابخانه دارید، به ما اطلاع دهید. لطفاً قبل از ایجاد کتابخانه جدید، به مسائل موجود در این کتابخانه نگاهی بیندازید. با کلیک کردن روی دکمه ستاره می توانید رای خود را به یک موضوع موجود اضافه کنید.

یک شماره جدید ایجاد کنید

برای اطلاعات بیشتر به مستندات ردیاب مشکل مراجعه کنید.

نسخه 1.4

Version 1.4.0-alpha11

9 آوریل 2025

androidx.benchmark:benchmark-*:1.4.0-alpha11 is released. Version 1.4.0-alpha11 contains these commits .

تغییرات API

  • Changed TraceProcessor 's argument timeout: Duration to timeoutMs long for Java caller usability. ( I9fbb5 )
  • Mark TraceProcessor constructor as internal. Callers should use TraceProcessor.startServer or TraceProcessor.runServer . ( Ia8c5b )

رفع اشکال

  • When killing the application with MacrobenchmarkScope.killProcess , validate the kill command results to prevent silent failure, and timeout error. ( I84555 )

به روز رسانی های وابستگی

  • This library now targets Kotlin 2.0 language level and requires KGP 2.0.0 or newer. ( Idb6b5 )

Version 1.4.0-alpha10

26 مارس 2025

androidx.benchmark:benchmark-*:1.4.0-alpha10 is released. Version 1.4.0-alpha10 contains these commits .

تغییرات API

  • Increased default timeout for TraceProcessor server load and querying to 120 seconds (from 60/30 previously), and made both configurable with one timeout parameter. ( Ifec87 )

رفع اشکال

  • Fixed a few issues that would occur when benchmarking or capturing profiles of an app without profileinstaller , and it's included BroadcastReciever . This only affects runs on rooted devices. ( Ied308 )

Version 1.4.0-alpha09

12 مارس 2025

androidx.benchmark:benchmark-*:1.4.0-alpha09 is released. Version 1.4.0-alpha09 contains these commits .

تغییرات API

  • Added TraceProcessor and Session API with closable Handles, for easier usage with custom lifecycles. This is also a step towards enabling easier Coroutine and Java API usage. The extension functions to TraceProcessor.runServer {} are now marked experimental, as they're likely to move, and be made non-experimental in the future. ( I358b4 )

رفع اشکال

  • Fixed Benchmark and Baseline Profile capture not working with API 36 due to a change in pgrep toybox that now requires -a to print the full command line. ( Idc991 )
  • Filter default tracing config to reduce risk of data loss in traces on newer API levels. ( I54e8a )
  • Added experimental androidx.benchmark.killExistingPerfettoRecordings instrumentation argument, which can be set to false to allow pre existing perfetto trace capture to continue. By default pre existing perfetto trace captures on device are killed to prevent interference. ( I02a3c )
  • The JSON field context.osCodenameAbbreviated will now be REL for released OS versions at and above API 35, as non-numeric code names are no longer supported by the underlying platform. ( Ib17fd )
  • Fixes crash in FrameTimingMetric when resynced frames occur. ( I7c6f4 , b/394610806 )
  • No longer assume Choreographer#doFrame is the top of the stack frame on the main thread for FrameTimingQuery . ( Iee0e0 , b/340206285 )

Version 1.4.0-alpha08

12 فوریه 2025

androidx.benchmark:benchmark-*:1.4.0-alpha08 is released. Version 1.4.0-alpha08 contains these commits .

تغییرات API

  • Moved TraceProcessor.runSession() extension APIs to be experimental, as they are likely to move to be concrete constructors eventually on Android. ( Ib0528 , b/393640753 )
  • Most of the implementation of Startup Insights are now public/experimental, and move to the TraceProcessor artifact See StartupInsights . ( I0aa00 )
  • Deprecate BenchmarkRule.runWithTimingDisabled {} in favor of BenchmarkRule.runWithMeasurementDisabled {} , which more clearly describes the behavior - all metrics are paused. Additionally, expose the MicrobenchmarkScope superclass since redeclaring the runWithMeasurementDisabled function to open access isn't possible, since it's inline. ( I9e23b , b/389149423 , b/149979716 )
  • Benchmark libraries have moved to Kotlin 2.0. ( I9d1e0 )
  • Removed androidx.benchmark.startupProfiles.enable instrumentation argument. It is no longer useful, as it can be controlled by includeInStartupProfile arg in BaselineProfileRule.collect() . ( I39eb4 )

رفع اشکال

  • Reduced the amount of Microbenchmark internal functions called during profiling to make eg Method traces more clear ( Ifaed8 )
  • Speculative fix for crashes: 'Failed to stop [ ProcessPid(processName=perfetto, pid=...) ]'. Now Benchmark will log a message instead of crashing when a background Perfetto process isn't able to be stopped before running the benchmark. ( I37d3e , b/323601788 )
  • Fix IllegalStateExceptions with 'Expected pm dump-profiles stdout' label that were caused by overly strict output format check. ( I358dc )

Version 1.4.0-alpha07

29 ژانویه 2025

androidx.benchmark:benchmark-*:1.4.0-alpha07 is released. Version 1.4.0-alpha07 contains these commits .

ویژگی های جدید

  • BaselineProfileRule now introduces a collectWithResults(...) API which includes a list of paths to the computed profiles. ( I056f8 )
  • Added androidx.benchmark.measureRepeatedOnMainThread.throwOnDeadline instrumentation argument, which can be set to false to disable the throw on deadline behavior of measureRepeatedOnMainThread for local testing. Not otherwise recommended, as this increases the likelihood of ANRs during tests. ( Idbeec , b/353226476 )

تغییرات API

  • Added @JvmOverloads to MicrobenchmarkConfig constructor. ( I13fd3 )
  • Refactored BenchmarkRule to be built on top of coroutines, and support better yield() behavior. This refactor removed several experimental BenchmarkState APIs, but will be followed by replacements as needed. Additionally, added runWithMeasurementDisabled to clarify behavior (all measurement is paused). In the future, runWithTimingDisabled will be deprecated. ( I19837 , b/389149423 , b/311242861 )
  • Move PerfettoTraceProcessor to TraceProcessor in a new androidx.benchmark:benchmark-traceprocessor artifact, and make most of its API non-experimental. Any custom TraceMetric or anything reading from traces will need to update to the new TraceProcessor import. The new TraceProcessor API works exactly like the old one, but is a standalone interface library (somewhat analogous to the androidx.sqlite layer from Room) with an Android-specific implementation built into macrobenchmark. The new artifact can be used on JVM as well, but currently you'll need to start your own copy of the TraceProcessor binary and offer a port to connect to it on. ( I3a767 , I62563 , b/381134564 )

رفع اشکال

  • Throw a clearer error message when MacrobenchmarkScope.startActivityAndWait fails to launch the target process (potentially due to a crash in the target process), instead of the more ambiguous 'Unable to confirm activity launch completion' message ( I3539b )
  • Fixed several syntax errors in Kotlin samples, and syntax highlighting in several Java / build.gradle samples. ( Ib3808 )
  • Clarified ArtMetric and CaptureInfo parameter docs. ( I96e60 )

Version 1.4.0-alpha06

11 دسامبر 2024

androidx.benchmark:benchmark-*:1.4.0-alpha06 is released. Version 1.4.0-alpha06 contains these commits .

تغییرات API

  • Removed usage of @Language("sql") in PerfettoTraceProcessor.Session.query() , as Studio highlighting/parsing is broken. ( Idc2fa , b/377733398 )

رفع اشکال

  • این کتابخانه اکنون از حاشیه‌نویسی‌های پوچ JSpecify استفاده می‌کند که نوع استفاده هستند. Kotlin developers should use the following compiler arguments to enforce correct usage: -Xjspecify-annotations=strict , -Xtype-enhancement-improvements-strict-mode ( I46810 , b/326456246 )
  • Corrected ArtMetric to report class load (not init), and improved docs to clarify runtime behavior. ( I9915c )
  • On Android Multiuser, execute commands as root only on rooted devices. ( I88b44 )

نسخه 1.4.0-alpha05

13 نوامبر 2024

androidx.benchmark:benchmark-*:1.4.0-alpha05 is released. Version 1.4.0-alpha05 contains these commits .

رفع اشکال

  • Fixed an issue on API 34+ where CompilationMode.None() would have inconsistent performance not representative of initial, worst case performance. This works around a platform change which allows ART's compilation state verify to partially compile apps (only affecting class loading) shortly after first launch. ( Ie48d0 )
  • Fixed issue where (especially short) traces could be captured that wouldn't report measurement from built-in Macrobenchmark Metrics, due to the process name being truncated within the Perfetto trace. Now macrobenchmark works around this issue by looking for the truncated package name in all built-in queries, in addition to the expected package name. Note that custom TraceMetric implementations or other direct callers of PerfettoSession.query can implement this same behavior by changing process.name LIKE "$packageName" in a Perfetto query to instead be (process.name LIKE "$packageName" OR process.name LIKE "$(packageName.takeLast(15))") . ( I5bf01 , b/377565760 )

نسخه 1.4.0-alpha04

30 اکتبر 2024

androidx.benchmark:benchmark-*:1.4.0-alpha04 is released. Version 1.4.0-alpha04 contains these commits .

ویژگی های جدید

  • (Experimental) Enable Baseline Profile generation, and benchmarking on apps installed to a secondary user, for example any app on headless Android Auto devices. This support has been tested in some scenarios, but let us know with a bug if it doesn't work for you. ( I9fcbe , b/356684617 , b/373641155 )

رفع اشکال

  • isProfileable is now always overridden in benchmark builds, and isDebuggable is also now always overridden in both benchmark and nonMinified (baseline profile capture) builds. ( I487fa , b/369213505 )
  • Fixes compilation detection on some physical devices prior to API 28 - affects json context.compilationMode , as well as behavior of androidx.benchmark.requireAot=true (which no longer incorrectly throws) ( Ic3e08 , b/374362482 )
  • In CpuEventCounter metrics, throw if invalid measurements are observed (eg instructions/cpucycles==0) ( I8c503 )

نسخه 1.4.0-alpha03

16 اکتبر 2024

androidx.benchmark:benchmark-*:1.4.0-alpha03 is released. Version 1.4.0-alpha03 contains these commits .

تغییرات API

  • Macrobenchmark : Adds ArtMetric , which can be used to inspect profile coverage or general Android RunTime performance. Captures number and total duration of JIT, class init (where available), and class verification. Additionally, changes CaptureInfo to include optional ART mainline version with default. ( I930f7 )
  • Add coefficientOfVariation to Benchmark JSON output to show stability within a given benchmark run. ( Ib14ea )

رفع اشکال

  • Fixed CollectBaselineProfileTask when AVD device has spaces in it. ( Ia0225 , b/371642809 )
  • Speculative fix for errors from StartupMode.COLD exceptions: Package <packagename> must not be running prior to cold start! . Now, MacrobenchmarkScope.killProcess() (including the one run before each iteration, used to implement StartupMode.COLD behavior) will wait to verify that the app's processes have all stopped running. ( I60aa6 , b/351582215 )
  • Fixed issue where UNLOCKED_ error would show up on some rooted emulators. ( Ic5117 )
  • این کتابخانه اکنون از حاشیه‌نویسی‌های پوچ JSpecify استفاده می‌کند که نوع استفاده هستند. Kotlin developers should use the following compiler arguments to enforce correct usage: -Xjspecify-annotations=strict , -Xtype-enhancement-improvements-strict-mode ( I7104f , b/326456246 )

نسخه 1.4.0-alpha02

2 اکتبر 2024

androidx.benchmark:benchmark-*:1.4.0-alpha02 is released. Version 1.4.0-alpha02 contains these commits .

تغییرات API

  • Moved Gradle tasks lockClocks and unlockClocks to be on benchmark projects, instead of available at the top level. This change was necessary as there is unfortunately no way to register these as top level actions without breaking project isolation. ( I02b8f , b/363325823 )

رفع اشکال

  • BaselineProfileRule now collects profiles for multi-process apps by signaling each running process at the end of the block to dump profiles. If a profile based compilation never successfully finds a process to broadcast to, the compilation will fail, as it's unexpected to have profile data within. Additionally, added an instrumentation argument to control dump wait duration: androidx.benchmark.saveProfileWaitMillis ( I0f519 , b/366231469 )
  • From Benchmark 1.3.2 : Fixed Firebase Test Lab (FTL) being unable to pull Baseline Profile or Macrobenchmark result files from the Baseline Profile Gradle Plugin. ( I2f678 , b/285187547 )

To use FTL apply the plugin to the baseline profile module in the plugin block, with:

  plugins {
      ...
      id("com.google.firebase.testlab")
  }

and then configure firebase test lab with:

  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}")
          }
      }
  }

Also the created FTL device needs to be added to the baseline profile extension:

  baselineProfile {
      managedDevices += "ftlDeviceShiba34"
      useConnectedDevices = false
  }

نسخه 1.4.0-alpha01

18 سپتامبر 2024

androidx.benchmark:benchmark-*:1.4.0-alpha01 is released. Version 1.4.0-alpha01 contains these commits .

New Feature - App Startup Insights

  • Initial version of app startup insights can be enabled in Macrobenchmark. ( 09fae38 )

To enable in a startup benchmark:

  @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(...)
      }
  }

Then running your startup benchmark will analyze the trace to look for common problems, and print them after metrics to Studio test output in the benchmark tab, eg:

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

This feature is still a work-in-progress, with improvements to documentation and extensibility to follow, but feedback is welcome.

ویژگی های جدید

  • Added gradle property androidx.baselineprofile.suppressWarnings to suppress all baseline profile warnings. ( 314153a )
  • Microbench metrics are now displayed in Perfetto traces as counters. ( 3214854 )
  • Add experimental scripts for disabling jit (requires root / runtime restart), and resetting device perf/test state. These are not currently published as gradle tasks. ( 7c3732b )
  • Added benchmark argument to skip tests when running on emulator. When automaticGenerationDuring build is enabled, benchmarks will also trigger baseline profile generation. This will fail, if emulators are used. With the new argument skipBenchmarksOnEmulator we can instead skip the test. ( 0c2ddcd )
  • Change perf event enable logic to run on API 23+ ( 2550048 )

تغییرات API

  • Existing experimental PerfettoConfig argument to MacrobenchmarkRule.measureRepeated() moved to the new ExperimentalConfig object.

رفع اشکال

  • Increase lockClocks.sh retry count ( 99e9dac )
  • Don't create nonMinified and benchmark build types if existing. Due to a bug, even if nonMinified and benchmark build types existed, they were going to be recreated. ( e75f0a5 )
  • Ignore non-terminating slices from TraceSectionMetric results. ( a927d20 )
  • Improved emulator check to consider sdk_ prefix. ( 1587de8 )
  • Treat non-running packages as cleared in FrameTimingGfxInfoMetric . ( 35cc79c )
  • Fix androidx.benchmark.cpuEventCounter producing corrupt values for non-Instruction events. ( 06edd59 )
  • Fix resumeTiming/runWithTimingDisabled to respect metric priority order, and significantly reduce impact of lower priority metric pause/resume on higher priority metric results. For example, if using cpu perf counters via cpuEventCounter.enable instrumentation argument, timeNs is no longer significantly reduced when pause/resume occur. ( 5de0968 )

نسخه 1.3

نسخه 1.3.4

26 مارس 2025

androidx.benchmark:benchmark-*:1.3.4 is released. Version 1.3.4 contains these commits .

رفع اشکال

  • Fixed Gradle Project Isolation incompatibilities in the Benchmark Baseline Gradle Plugin. ( b/404523257 )

نسخه 1.3.3

16 اکتبر 2024

androidx.benchmark:benchmark-*:1.3.3 is released. Version 1.3.3 contains these commits .

رفع اشکال

  • Fixed CollectBaselineProfileTask when AVD device has spaces in it ( Ia0225 , b/371642809 )

نسخه 1.3.2

2 اکتبر 2024

androidx.benchmark:benchmark-*:1.3.2 is released. Version 1.3.2 contains these commits .

رفع اشکال

  • Fixed Firebase Test Lab (FTL) being unable to pull Baseline Profile or Macrobenchmark result files from the Baseline Profile Gradle Plugin. ( I2f678 , b/285187547 )

To use FTL apply the plugin to the baseline profile module in the plugin block, with:

  plugins {
      ...
      id("com.google.firebase.testlab")
  }

and then configure firebase test lab with:

  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}")
          }
      }
  }

Also the created FTL device needs to be added to the baseline profile extension:

  baselineProfile {
      managedDevices += "ftlDeviceShiba34"
      useConnectedDevices = false
  }

نسخه 1.3.1

18 سپتامبر 2024

androidx.benchmark:benchmark-*:1.3.1 is released. Version 1.3.1 contains these commits .

رفع اشکال

  • Added gradle property androidx.baselineprofile.suppressWarnings to suppress all baseline profile warnings ( I7c36e , b/349646646 )
  • Fixed Baseline Profile Gradle Plugin to use pre-existing nonMinified… and benchmark… if created by the app instead of creating wrappers. ( Ia8934 , b/361370179 )
  • Fixed java.lang.AssertionError: ERRORS (not suppressed): EMULATOR when automaticGenerationDuringBuild is enabled on emulators. New argument is used to instead skip the test. ( If3f51 , b/355515798 )
  • Microbenchmark minification - keep subclasses of org.junit.runner.notification.RunListener in benchmark library proguard ( Ic8ed5 , b/354264743 )
  • Fix TraceSectionMetric to Ignore non-terminating slices. Previously these were considered to have -1 duration, eg during summation or finding minimum duration. ( If74b7 )
  • Fixed an issue in FrameTimingGfxInfoMetric where starting the metric would crash if the process wasn't already running. ( I6e412 )

نسخه 1.3.0

21 آگوست 2024

androidx.benchmark:benchmark-*:1.3.0 is released. Version 1.3.0 contains these commits .

Microbenchmark changes since 1.2.0

  • Method tracing is on by default in microbenchmarks when running on most devices
    • Method tracing runs as a separate phase, after measurements - this enables accurate measurements and method traces to both be output from a single benchmark run
    • Method tracing on some Android OS and ART versions will affect later measurement phases - on these versions, method tracing is off by default and a warning is printed to Studio output
  • Main thread benchmarks and ANRs
    • Added measureRepeatedOnMainThread for UI thread benchmarks (eg those that interact with Compose/View UIs) to avoid ANRs when running for many seconds.
    • Method traces are skipped if expected to overrun the ANR avoidance deadline. Set androidx.benchmark.profiling.skipWhenDurationRisksAnr to false to disable this behavior (not recommended for CI runs, as ANRs can cause problem in long CI runs).
  • کوچک سازی
    • Embedded proguard rules to improve microbenchmarking with minification enabled
    • Minification/R8 in a library module requires AGP 8.3, and can be enabled via android.buildTypes.release.androidTest.enableMinification in your build.gradle
    • Experimental BlackHole.consume() API added to prevent dead code elimination ( If6812 , b/286091643 )
  • معیارها
    • Experimental cpu event counter feature (metrics from perf_event_open , which requires root on most versions of the platform), access via InstrumentationArgument androidx.benchmark.cpuEventCounter.enable (can be set to true ), and androidx.benchmark.cpuEventCounter.events can be set eg to ( Instructions,CpuCycles ). This should be supported on some userdebug emulators, but support has not been tested across all available emulators

MACRObenchmark changes since 1.2.0

  • Method tracing overhaul for macrobenchmarks.
    • Now method traces are scoped to the duration of the measureBlock , and can capture multiple sessions if the process starts multiple times.
    • Previously, method tracing would only work for StartupMode.COLD benchmarks, and capture nothing for measureBlocks that didn't restart the target process
    • Fixed method traces flush in macrobenchmark, so that method traces should be fully captured and valid, even on slower devices. ( I6349a , b/329904950 )
  • Correctly dump ART profile during individual warmUp iterations when process is killed so CompilationMode.Partial(warmup=N) measurements are more accurate. ( I17923 )
  • Drop Shader broadcast failure message
    • Added debugging suggestions to drop shader broadcast failure message
    • Add two instrumentation arguments for overriding shader dropping behavior to workaround crashes when benchmarking apps without ProfileInstaller 1.3:
      • androidx.benchmark.dropShaders.enable=true/false : can be used to skip all shader dropping (including that done in StartupMode.Cold launches), 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 )
  • Added experimental MacrobenchmarkRule#measureRepeated variant which takes a custom PerfettoConfig for fully customized Perfetto trace recording. Note that incorrectly configured configs may cause built in Metric classes to fail. ( Idfd3d , b/309841164 , b/304038384 )
  • Cancel background dexopt jobs before running a Macrobenchmark to reduce interference. ( I989ed )
  • Macrobenchmark now waits for 1 second for the target application to flush an ART profile (previously it waited for 500 ms). ( I85a50 , b/316082056 )
  • TraceSectionMetric overhaul
    • Note : TraceSectionMetric changes below can affect outputs in CI usage, and may create discontinuities, or break parsing
    • Sum is now the default, as most usage of this metric is for repeated events, and first would discard data in these cases
    • Changed to be more customizable, with more available modes
    • Mode names are now embedded in metric output name (in Studio and JSON)
    • Now supports slices created using Trace.{begin|end}AsyncSection .
  • معیارها
    • Power - Added PowerMetric.deviceSupportsHighPrecisionTracking , PowerMetric.deviceBatteryHasMinimumCharge() and PowerMetric.deviceSupportsPowerEnergy()
    • Renamed Metric.getResult to getMeasurements to match return type
    • 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 )
    • Added frameCount measurement to FrameTimingMetric to aid in discovery of scenarios where measurements change because the number of frames produced changed (new animations added, invalidation issues fixed). ( I1e5aa )
    • Clarified that frameOverrunMs is the preferred metric for tracking when available in docs, and why. ( I18749 , b/329478323 )
    • 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 )
    • Improve FrameTimingMetric error when frames aren't produced, and always output link to trace when failing metric parsing to assist in diagnosing problem. ( I956b9 )
    • Fixed crash in FrameTimingMetric failing 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 )

Baseline Profile capture / Gradle plugin changes since 1.2.0

  • Increased max recommended version of AGP to 9.0.0-alpha01.
  • Ensure mergeArtProfile and mergeStartupProfile tasks always wait for baseline profile generation. ( I623d6 , b/343086054 )
  • Generating a baseline profile successfully will output a summary of what changed ( I824c8 , b/269484510 )
  • Added DSL to disable warnings ( Ic4deb , b/331237001 )
  • Fix to ensure benchmarks use generated baseline profiles when automaticGenerationDuringBuild is off ( Ic144f , b/333024280 )
  • Fix BaselineProfile gradle plugin property overrides to enable baseline profile generation and benchmarking when customizing a nonMinified or benchmark build type. ( Ib8f05 , b/324837887 )
  • 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 )

Other significant changes since 1.2.0

  • Trace capture
    • Reduced EXITCODE 2 error when starting perfetto from an error to logged warning
    • Enable AIDL tracing by default in benchmarks(requires API 28) ( Ia0af2 , b/341852305 )
    • Enable porter tag tracing by default in benchmarks. This captures, for example, wakelock tracepoints. ( Icfe44 , b/286551983 )
    • Increased trace capture start timeout to avoid crashes when starting tracing on slower devices ( I98841 , b/329145808 )
    • Added public API PerfettoTraceProcessor.Session.queryMetrics APIs with JSON, textproto, and proto binary (undecoded) variants. These allow you to query metrics built into TraceProcessor ( I54d7f , b/304038382 )
    • 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 )
  • خروجی JSON
    • 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 - Equals android.os.Build.ID
      • context.build.version.codename - Equals android.os.Build.VERSION.CODENAME
      • context.build.version.abbreviatedCodename - corresponds to first letter of pre-release codename (including on release builds) ( Ie5020 )
    • Added profilerOutput list to JSON output for easier tooling around profiling traces (eg Perfetto, Method traces) ( I05ddd , b/332604449 )
    • 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 )
    • Throw when filenames are longer than 200 chars to avoid unclear crashes when writing or post-processing files. ( I4a5ab )

نسخه 1.3.0-RC01

7 آگوست 2024

androidx.benchmark:benchmark-*:1.3.0-rc01 is released. Version 1.3.0-rc01 contains these commits .

رفع اشکال

  • Fix androidx.benchmark.cpuEventCounter producing corrupt values for non-Instruction events ( I7386a , b/286306579 )
  • Fix resumeTiming / runWithTimingDisabled to respect metric priority order, and significantly reduce impact of lower priority metric pause/resume on higher priority metric results. For example, if using cpu perf counters via cpuEventCounter.enable instrumentation argument, timeNs is no longer significantly reduced when pause/resume occur. ( I39c2e , b/286306579 , b/307445225 )
  • Reduced chance of stack sampling causing measureRepeatedOnMainThread from hitting main thread hard timeout by moving stack sampling conversion off main thread. ( I487a8 , b/342237318 )
  • Removed manual outlining of access to new platform APIs since this happens automatically via API modeling when using R8 with AGP 7.3 or later (eg R8 version 3.3) and for all builds when using AGP 8.1 or later (eg D8 version 8.1). Clients who are not using AGP are advised to update to D8 version 8.1 or later. برای جزئیات بیشتر به این مقاله مراجعه کنید. ( 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 )

نسخه 1.3.0-beta02

10 جولای 2024

androidx.benchmark:benchmark-*:1.3.0-beta02 is released. Version 1.3.0-beta02 contains these commits .

رفع اشکال

  • Gracefully handle EXITCODE 2 when starting Perfetto to log a warning, but proceed.

نسخه 1.3.0-beta01

12 ژوئن 2024

androidx.benchmark:benchmark-*:1.3.0-beta01 is released. Version 1.3.0-beta01 contains these commits .

تغییرات API

  • Renamed MethodTracing.affectsMeasurementOnThisDevice to AFFECTS_MEASUREMENT_ON_THIS_DEVICE for 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 via ProfilerConfig.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 - Equals android.os.Build.ID
    • context.build.version.codename - Equals android.os.Build.VERSION.CODENAME
    • context.build.version.abbreviatedCodename - corresponds to first letter of pre-release codename (even on release builds) ( Ie5020 )
  • Fixes StackSampling to respect androidx.benchmark.profiling.sampleDurationSeconds ( Ib1d53 )
  • Change macro->common dependency to be api() , so it's easier to use eg PerfettoTrace and PerfettoConfig . ( Icdae3 , b/341851833 )
  • Ensure mergeArtProfile and mergeStartupProfile tasks 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

14 مه 2024

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

1 مه 2024

androidx.benchmark:benchmark-*:1.3.0-alpha04 is released. Version 1.3.0-alpha04 contains these commits .

تغییرات API

  • Added experimental MacrobenchmarkRule#measureRepeated variant which takes a custom PerfettoConfig for 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.deviceSupportsPowerEnergy to PowerMetric.deviceSupportsHighPrecisionTracking for clarity ( I5b82f )
  • Added PowerMetric.deviceBatteryHasMinimumCharge() and PowerMetric.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 )

نسخه 1.3.0-alpha03

17 آوریل 2024

androidx.benchmark:benchmark-*:1.3.0-alpha03 is released. Version 1.3.0-alpha03 contains these commits .

ویژگی های جدید

  • Adds public API PerfettoTraceProcessor.Session.queryMetrics APIs with JSON, textproto, and proto binary (undecoded) variants. These allow you to query metrics built into TraceProcessor ( I54d7f , b/304038382 )
  • Added profilerOutput to 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

  • Changed TraceSectionMetric.Mode to sealed class to enable future expansion without breaking exhaustive when statements ( I71f7b )
  • Added TraceSectionMetric.Mode.Average and .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.getResult to getMeasurements to match return type ( I42595 )

رفع اشکال

  • Fix to ensure benchmarks use generated baseline profiles when automaticGenerationDuringBuild is off ( Ic144f , b/333024280 )
  • Fix BaselineProfile gradle plugin property overrides to enable baseline profile generation and benchmarking when customizing a nonMinified or 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 )
  • TraceSectionMetric now supports slices created using Trace.{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 frameCount measurement to FrameTimingMetric to aid in discovery of scenarios where measurements change because the number of frames produced changed (new animations added, invalidation issues fixed). ( I1e5aa )
  • Clarified that frameOverrunMs is the preferred metric for tracking when available in docs, and why. ( I18749 , b/329478323 )

نسخه 1.3.0-alpha02

20 مارس 2024

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 )

نسخه 1.3.0-alpha01

21 فوریه 2024

androidx.benchmark:benchmark-*:1.3.0-alpha01 is released. نسخه 1.3.0-alpha01 شامل این تعهدات است.

تغییرات API

  • Renamed MicrobenchmarkConfig boolean parameters to avoid unnecessary word 'should' ( Ia8f00 , b/303387299 )
  • Added BenchmarkRule.measureRepeatedOnMainThread so 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 of FrameTimingMetric with 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 warmUp iterations. ( I17923 )
  • Several changes to TraceSectionMetric API:
    • 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 )

رفع اشکال

  • 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 ProfileInstaller 1.3:
    • androidx.benchmark.dropShaders.enable=true/false : can be used to skip all shader dropping (including that done in StartupMode.Cold launches), 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 verification on 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-stop to kill apps when not a system app like System UI or Launcher. ( I5e028 )
  • Macrobenchmark now waits for 1 second for the target application to flush an ART profile (previously it waited for 500 ms ). ( I85a50 , b/316082056 )
  • Improve FrameTimingMetric error when frames aren't produced, and always output link to trace when failing metric parsing to assist in diagnosing problem. ( I956b9 )
  • Fixed crash in FrameTimingMetric failing 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 )

نسخه 1.2

نسخه 1.2.4

17 آوریل 2024

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 automaticGenerationDuringBuild in libraries causing a circular dependency. ( I28ab7 , b/333024280 )
  • Use am force-stop to kill apps when not a system app like System UI or Launcher. This fixes StartupMode.COLD benchmarks crashing from "Package $package must not be running prior to cold start!" due to process kill not fully succeeding. ( I5e028 )

نسخه 1.2.3

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.

نسخه 1.2.2

1 دسامبر 2023

androidx.benchmark:benchmark-*:1.2.2 is released. Version 1.2.2 contains these commits.

Baseline Profiles

نسخه 1.2.1

15 نوامبر 2023

androidx.benchmark:benchmark-*:1.2.1 is released. نسخه 1.2.1 شامل این تعهدات است.

ویژگی های جدید

نسخه 1.2.0

18 اکتبر 2023

androidx.benchmark:benchmark-*:1.2.0 is released. نسخه 1.2.0 شامل این تعهدات است.

تغییرات مهم از 1.1.0

Baseline Profiles

  • New Baseline Profile Gradle Plugin automates capturing and including baseline profiles in your test and build workflow.
  • BaselineProfileRule.collect now stable, a streamlined and simplified version of the previous experimental BaselineProfileRule.collectBaselineProfile API
    • Just specify packageName , and drive your app
  • For libraries generating baseline profiles, you can now filter the rules generated either in code ( BaselineProfileRule.collect argument), or even more simply in the gradle plugin
  • رفع می کند

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.enable instrumentation argument, (already available in microbenchmark) for quicker validation runs (eg when creating the benchmark, or in presubmit)
    • Support for androidx.benchmark.profiling.mode=StackSampling and MethodTracing .
    • Added androidx.benchmark.enabledRules to allow runtime filtering baseline profile vs macrobenchmark rule tests
    • Added androidx.benchmark.perfettoSdkTracing.enable argument to enable tracing with tracing-perfetto, eg Compose recomposition tracing. Note that when used with StartupMode.COLD , timing will be significantly affected as the tracing library is loaded and enabled during app startup.
  • الزامات

    • Macrobenchmark now requires ProfileInstaller 1.3.0 or greater in the target app, to enable profile capture / reset, and shader cache clearing.
  • New Experimental Metric APIs

  • رفع می کند

    • Fixed crashes when installing or extracting profiles from an app installed from multiple APKs (eg from app bundle).
    • Fixed FrameTimingMetric ignoring 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.COLD by consistently dropping the shader cache (also exposed via MacrobenchmarkScope.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.
  • APIهای آزمایشی
    • Added experimental MicrobenchmarkConfig API 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 BenchmarkState separately from BenchmarkRule , without JUnit
    • Added experimental PerfettoTrace record to enable capturing Perfetto traces, with custom configuration, separate from benchmark APIs.
  • رفع می کند
    • Workaround missing leading whitespaces in Android Studio benchmark output.
    • Fix issue where warnings could fail to print in Android Studio benchmark output.
    • Fixed SampledProfiling crash on Android 13 (API 33) and higher.
    • Massively improved performance of dryRunMode by skipping IsolationActivity and Perfetto tracing (Up to 10x faster dry run mode on older OS versions).

نسخه 1.2.0-RC02

6 اکتبر 2023

androidx.benchmark:benchmark-*:1.2.0-rc02 is released. نسخه 1.2.0-RC02 شامل این تعهدات است.

رفع اشکال

  • Fix Benchmark file output to no longer break BaselineProfile Plugin 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-perfetto loading error messages when injecting from macrobenchmark module into target application.

نسخه 1.2.0-RC01

20 سپتامبر 2023

androidx.benchmark:benchmark-*:1.2.0-rc01 is released. نسخه 1.2.0-RC01 شامل این تعهدات است.

رفع اشکال

  • 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

30 آگوست 2023

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

23 آگوست 2023

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 )

نسخه 1.2.0-beta03

9 آگوست 2023

androidx.benchmark:benchmark-*:1.2.0-beta03 is released. نسخه 1.2.0-beta03 شامل این تعهدات است.

تغییرات API

  • Added argument to filter TraceSectionMetric to only the target package, on by default ( Ia219b , b/292208786 )

رفع اشکال

  • Renamed fullTracing.enable instrumentation argument to perfettoSdkTracing.enable for consistency with artifact name, and other references. fullTracing.enable will 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 )

نسخه 1.2.0-beta02

26 جولای 2023

androidx.benchmark:benchmark-*:1.2.0-beta02 is released. نسخه 1.2.0-beta02 شامل این تعهدات است.

تغییرات API

  • 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.0 an api instead of an implementation dependency. ( I1981e )

نسخه 1.2.0-beta01

18 جولای 2023

androidx.benchmark:benchmark-*:1.2.0-beta01 is released. نسخه 1.2.0-beta01 شامل این تعهدات است.

رفع اشکال

  • 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 named frameDurationCpuMs . ( Ib097f , b/288830934 ).

Version 1.2.0-alpha16

21 ژوئن 2023

androidx.benchmark:benchmark-*:1.2.0-alpha16 is released. Version 1.2.0-alpha16 contains these commits.

تغییرات API

  • BaselineProfileRule.collectBaselineProfile() API has been renamed to BaselineProfileRule.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. MethodTracing trace sections are also now included in the captured Perfetto trace, if present. ( I9f657 , b/285014599 )
  • Add count measurement to TraceSectionMetric with Mode.Sum . ( Ic121a , b/264398606 )

Version 1.2.0-alpha15

7 ژوئن 2023

androidx.benchmark:benchmark-*:1.2.0-alpha15 is released. Version 1.2.0-alpha15 contains these commits.

ویژگی های جدید

  • Added experimental MemoryUsageMetric for 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

  • The collectBaselineProfile API always generates stable baseline profiles. The collectStableBaselineProfile API has been removed and collectBaselineProfile should be used instead. ( I17262 , b/281078707 )
  • Changed BaselineProfileRule 's filterPredicate arg to non-null, with a equivalent default value so that the default filter behavior is more clear in docs. ( I3816e )

رفع اشکال

  • Disable IsolationActivity and Perfetto tracing in dryRunMode to 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=StackSampling and androidx.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

3 مه 2023

androidx.benchmark:benchmark-*:1.2.0-alpha14 is released. Version 1.2.0-alpha14 contains these commits.

رفع اشکال

  • Fix FrameTimingMetric ignoring frames with inconsistent frame IDs. This would cause some animations on recent platform versions (API 31+) to ignore many frames while RenderThread was 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-profiles command. ( Id1392 , b/277645214 )
  • Fix GPU clock locking script to compare strings correctly ( I53e54 , b/213935715 )

Version 1.2.0-alpha13

5 آوریل 2023

androidx.benchmark:benchmark-*:1.2.0-alpha13 is released. Version 1.2.0-alpha13 contains these commits.

تغییرات API

  • Added profile type parameter when generating baseline profiles to support upcoming startup profile feature ( Ie20d7 , b/275093123 )
  • Added new experimental TraceMetric API 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

22 مارس 2023

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

  • Removed Perfetto tracing support on API 21 and 22, which includes both Microbenchmarks and the experimental PerfettoTrace APIs. Prior to this version, UiAutomation connections were unreliable on some devices. ( I78e8c )
  • Added public experimental API for PerfettoTraceProcessor to 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

8 مارس 2023

androidx.benchmark:benchmark-*:1.2.0-alpha11 is released. Version 1.2.0-alpha11 contains these commits.

رفع اشکال

  • Fixed crashes in MacrobenchmarkRule and BaselineProfileRule when reinstalling or extracting profiles from an app bundle with multiple APKs. ( I0d8c8 , b/270587281 )

Version 1.2.0-alpha10

22 فوریه 2023

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 DryRunMode to 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 PowerMetric crash when checking for powerstats presence on old API levels. ( 5faaf9 , b/268253898 )

Version 1.2.0-alpha09

11 ژانویه 2023

androidx.benchmark:benchmark-*:1.2.0-alpha09 is released. Version 1.2.0-alpha09 contains these commits.

رفع اشکال

  • Enabled passing None to androidx.benchmark.enabledRules instrumentation arg to disable all benchmarks / baseline profile generation. ( I3d7fd , b/258671856 )
  • Fix PerfettoTrace capture 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 )

نسخه 1.2.0-alpha08

7 دسامبر 2022

androidx.benchmark:benchmark-*:1.2.0-alpha08 is released. نسخه 1.2.0-alpha08 شامل این تعهدات است.

تغییرات API

  • Added experimental new APIs PerfettoTrace.record {} and PerfettoTraceRule to capture Perfetto traces (also known as System Traces) as part of a test, to inspect test behavior and performance. ( I3ba16 )
  • BaselineProfileRule now 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.collectStableBaselineProfile which 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 simpleperf trace 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>

نسخه 1.2.0-alpha07

9 نوامبر 2022

androidx.benchmark:benchmark-*:1.2.0-alpha07 is released. نسخه 1.2.0-alpha07 شامل این تعهدات است.

تغییرات API

  • Adds PowerMetric API 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 from StartupMode.COLD benchmarks, as shaders are now consistently cleared each iteration. Previously, Partial compilation 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 using profileinstaller:1.3.0-alpha02 in the target app. For ProfileInstaller library'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 metric inflateMs for the total time in a macrobenchmark spent on inflation. Also removed API 29 requirement, as TraceSectionMetric works together with androidx.tracing.Trace back to lower API levels, with the use of forceEnableAppTracing within 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 pull command, 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() where StartupMode.COLD wouldn't kill the target process after setupBlock . Now setupBlock interacting with the app will not leave the app process running, and an invalid cold start measurement. ( I8ebb7 )

نسخه 1.2.0-alpha06

24 اکتبر 2022

androidx.benchmark:benchmark-*:1.2.0-alpha06 is released. نسخه 1.2.0-alpha06 شامل این تعهدات است.

تغییرات API

  • BaselineProfileRule no 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 BaselineProfileRule or CompilationMode.Partial(warmupIterations) on an unrooted device, you must also update your target app to use androidx.profileinstaller.profileinstaller:1.3.0-alpha01 . This enables flushing the profile to disk correctly, so that it can be compiled/extracted.

رفع اشکال

نسخه 1.2.0-alpha05

5 اکتبر 2022

androidx.benchmark:benchmark-*:1.2.0-alpha05 is released. نسخه 1.2.0-alpha05 شامل این تعهدات است.

رفع اشکال

  • Fix frame breakdown in Studio system trace viewer for benchmark captured traces ( I3f3ae , b/239677443 )
  • Correct FrameTimingMetric to list FrameOverrun as 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 )

نسخه 1.2.0-alpha04

21 سپتامبر 2022

androidx.benchmark:benchmark-*:1.2.0-alpha04 is released. نسخه 1.2.0-alpha04 شامل این تعهدات است.

ویژگی های جدید

  • Add support for dryRunMode.enable instrumentation 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=true
    

    In build.gradle:

    android {
        defaultConfig {
            testInstrumentationRunnerArgument 'androidx.benchmark.dryRunMode.enable', 'true'
        }
    }
    

رفع اشکال

  • Fixed StartupTimingMetric to no longer require measured Activities to be launched through MacrobenchmarkScope.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 startActivityAndWait would timeout trying to wait for launch completion on emulators by reducing strictness of frame detection. ( Ibe2c6 , b/244594339 , b/228946895 )

نسخه 1.2.0-alpha03

7 سپتامبر 2022

androidx.benchmark:benchmark-*:1.2.0-alpha03 is released. نسخه 1.2.0-alpha03 شامل این تعهدات است.

ویژگی های جدید

  • Added experimental APIs for using BenchmarkState independently, separate from BenchmarkRule / JUnit4 . ( Id478f , b/228489614 )

رفع اشکال

نسخه 1.2.0-alpha02

24 آگوست 2022

androidx.benchmark:benchmark-*:1.2.0-alpha02 is released. نسخه 1.2.0-alpha02 شامل این تعهدات است.

تغییرات API

  • Default to am force stop for MacrobenchmarkScope.killProcess() , even when rooted, except during Baseline Profile generation. This can be overridden with an optional boolean argument. ( 02cce9 , b/241214097 )

رفع اشکال

نسخه 1.2.0-alpha01

27 جولای 2022

androidx.benchmark:benchmark-*:1.2.0-alpha01 is released. نسخه 1.2.0-alpha01 شامل این تعهدات است.

ویژگی های جدید

  • New tracing-perfetto-common component allowing tooling to enable Perfetto SDK tracing in an app that exposes it ( I2cc7f )
  • Added androidx.benchmark.enabledRules instrumentation 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 generating BaselineProfiles on 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

  • Added new PowerMetric for measuring energy and power tasks in benchmarks. ( I9f39b , b/220183779 )
  • Added a new compilation mode CompilationMode.Ignore to skip profile reset and compilation. ( Ibbcf8 , b/230453509 )
  • Added a new parameter to BaselineProfileRule#collectBaselineProfile to 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 UnsupportedOperationException was 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 TotalPowerMetric and TotalEnergyMetric for 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 )

نسخه 1.1.1

نسخه 1.1.1

9 نوامبر 2022

androidx.benchmark:benchmark-*:1.1.1 is released. نسخه 1.1.1 شامل این تعهدات است.

رفع اشکال

  • Fixes android.system.ErrnoException: open failed: EACCES which would occur on some Android11 (API 30)+ devices. This is a cherry-pick of a fix from 1.2.0-alpha01 . ( aosp/2072249 )

نسخه 1.1.0

نسخه 1.1.0

15 ژوئن 2022

androidx.benchmark:benchmark-*:1.1.0 is released. نسخه 1.1.0 شامل این تعهدات است.

  • This version is identical to androidx.benchmark:benchmark-*:1.1.0-rc03 .

تغییرات مهم از 1.0.0

نسخه 1.1.0-RC03

1 ژوئن 2022

androidx.benchmark:benchmark-*:1.1.0-rc03 is released. نسخه 1.1.0-RC03 شامل این تعهدات است.

رفع اشکال

Version 1.1.0-rc02

11 مه 2022

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 CompilationMode having 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=false
    
  • Made it possible to share a module between macrobenchmarks and baseline profile generating tests by adding androidx.benchmark.enabledRules instrumentation argument. Pass in 'Macrobenchmark', or 'BaselineProfile' to just run one type of test, eg when generating BaselineProfiles on 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
    

نسخه 1.1.0-rc01

20 آوریل 2022

androidx.benchmark:benchmark-*:1.1.0-rc01 is released. نسخه 1.1.0-RC01 شامل این تعهدات است.

رفع اشکال

  • 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

6 آوریل 2022

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 than Compilation.None() . ( 611ac9 ).

Version 1.1.0-beta05

23 مارس 2022

androidx.benchmark:benchmark-*:1.1.0-beta05 is released. Version 1.1.0-beta05 contains these commits.

رفع اشکال

نسخه 1.1.0-beta04

23 فوریه 2022

androidx.benchmark:benchmark-*:1.1.0-beta04 is released. نسخه 1.1.0-beta04 شامل این تعهدات است.

رفع اشکال

  • Fix missing metrics on Android 10, and NoSuchElementException caused by process names not being captured correctly in traces. ( Ib4c17 , b/218668335 )

  • Use PowerManager for 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 measureRepeated thread 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 of androidx.profileinstaller and Android Gradle Plugin. aosp/1977029

نسخه 1.1.0-beta03

9 فوریه 2022

androidx.benchmark:benchmark-*:1.1.0-beta03 is released. نسخه 1.1.0-beta03 شامل این تعهدات است.

تغییرات API

  • Added AudioUnderrunMetric into macrobenchmark library under experimental flag to allow detection of audio underruns ( Ib5972 )
  • BaselineProfileRule no longer accepts a setup block as this functioned the same as the profileBlock . ( Ic7dfe , b/215536447 )

    برای مثال

    @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 -> FrameDurationUi to clarify these are durations, not timestamps, and to match prefixes. ( I0eba3 , b/216337830 )

نسخه 1.1.0-beta02

26 ژانویه 2022

androidx.benchmark:benchmark-*:1.1.0-beta02 is released. نسخه 1.1.0-beta02 شامل این تعهدات است.

رفع اشکال

  • 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 pull command in logcat and Studio output for pulling generated BaselineProfile text file. ( f08811 )

نسخه 1.1.0-beta01

12 ژانویه 2022

androidx.benchmark:benchmark-*:1.1.0-beta01 is released. نسخه 1.1.0-beta01 شامل این تعهدات است.

رفع اشکال

  • Fixes profiler argument enable being ignored. ( I37373 , b/210619998 )
  • Removed deprecated CompliationModes ( I98186 , b/213467659 )
  • Switched baseline profile arg of CompilationMode.Partial to enum for clarity. ( Id67ea )

Version 1.1.0-alpha13

15 دسامبر 2021

androidx.benchmark:benchmark-*:1.1.0-alpha13 is released. Version 1.1.0-alpha13 contains these commits.

تغییرات API

  • 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.Trace or androidx.tracing Jetpack 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 CompilationModes into 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 null in certain warmup scenarios). ( Id3b68 , b/208357448 , b/208369635 )

رفع اشکال

  • Fixed CompilationMode.Speed incorrectly treated as None ( I01137 )

Version 1.1.0-alpha12

17 نوامبر 2021

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

3 نوامبر 2021

androidx.benchmark:benchmark-*:1.1.0-alpha11 is released. Version 1.1.0-alpha11 contains these commits.

تغییرات API

  • Macrobenchmark now has a minSdkVersion of 23 . ( If2655 )
  • Adds a new experimental BaselineProfileRule which 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

27 اکتبر 2021

androidx.benchmark:benchmark-*:1.1.0-alpha10 is released. Version 1.1.0-alpha10 contains these commits.

تغییرات API

  • 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

13 اکتبر 2021

androidx.benchmark:benchmark-*:1.1.0-alpha09 is released. Version 1.1.0-alpha09 contains these commits.

رفع اشکال

Version 1.1.0-alpha08

29 سپتامبر 2021

androidx.benchmark:benchmark-*:1.1.0-alpha08 is released. Version 1.1.0-alpha08 contains these commits.

تغییرات API

  • 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

1 سپتامبر 2021

androidx.benchmark:benchmark-*:1.1.0-alpha07 is released. Version 1.1.0-alpha07 contains these commits.

تغییرات API

  • 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 ProfileInstaller to make it easier for apps using baseline profiles to run MacroBenchmarks using CompilationMode.BaselineProfile . ( I42657 , b/196074999 ) NOTE: requires also updating to androidx.profileinstaller:profileinstaller:1.1.0-alpha04 or greater.
  • StartupMode.COLD + CompilationMode.None benchmarks are now more stable. ( I770cd , b/196074999 )

نسخه 1.1.0-alpha06

18 آگوست 2021

androidx.benchmark:benchmark-*:1.1.0-alpha06 is released. نسخه 1.1.0-alpha06 شامل این تعهدات است.

تغییرات API

  • Added androidx.benchmark.iterations instrumentation 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.BaselineProfile is a work in progress. Avoid using it to determine how good a profile is for now.

نسخه 1.1.0-alpha05

4 آگوست 2021

androidx.benchmark:benchmark-*:1.1.0-alpha05 is released. نسخه 1.1.0-alpha05 شامل این تعهدات است.

1.1.0-alpha04 was cancelled before release due to a sporatic crash. b/193827052

تغییرات API

  • 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 EmptyActivity to bring the target app out of a force-stopped state to better support CompilationMode.BaselineProfile . ( Id7cac , b/192084204 )
  • Changed trace file extension to .perfetto-trace to 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 )

نسخه 1.1.0-alpha03

16 ژوئن 2021

androidx.benchmark:benchmark-*:1.1.0-alpha03 is released. نسخه 1.1.0-alpha03 شامل این تعهدات است.

ویژگی های جدید

رفع اشکال

  • 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.

    به عنوان مثال،

    testInstrumentationRunnerArguments["androidx.benchmark.suppressErrors"] = "EMULATOR,LOW-BATTERY"
    

نسخه 1.1.0-alpha02

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. نسخه 1.1.0-alpha02 شامل این تعهدات است.

ویژگی های جدید

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 )

نسخه 1.1.0-alpha01

10 ژوئن 2020

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. نسخه 1.1.0-alpha01 شامل این تعهدات است.

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:
    • testBuildType is 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.debug is 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 InstrumentationResultParser error 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.

نسخه 1.0.0

Benchmark Version 1.0.0

20 نوامبر 2019

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 .

ویژگی های اصلی 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

نسخه 1.0.0-RC01

23 اکتبر 2019

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

نسخه 1.0.0-beta01

9 اکتبر 2019

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. نسخه 1.0.0-beta01 حاوی این تعهدات است .

ویژگی های جدید

  • 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-lint dependency, 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 additionalTestOutputDir instrumentation 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

18 سپتامبر 2019

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 تغییر می کند

  • The experimental annotation ExperimentalAnnotationReport is now correctly public. Usage of the experimental BenchmarkState#report API now requires this annotation

نسخه 1.0.0-alpha05

5 سپتامبر 2019

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. commit های موجود در این نسخه را می توانید در اینجا بیابید.

API تغییر می کند

  • BenchmarkState.reportData API is now marked experimental

رفع اشکال

  • Fix for the clock-locking script, which would fail on devices that were either missing the cut or expr shell utilities.
  • Fixed an issue with ./gradlew lockClocks task that would hang on devices that were rooted with an older version of the su utility, which did not support the -c flag.

نسخه 1.0.0-alpha04

7 آگوست 2019

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. commit های موجود در این نسخه را می توانید در اینجا بیابید.

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
    • Now automatically disables test coverage, and sets the AndroidBenchmarkRunner by default ( b/138374050 )
    • Added support for new AGP-based data copy, when running benchmarks and when using AGP 3.6+
  • JSON format additions
    • Output total benchmark test run time ( b/133147694 )
    • @Parameterized benchmarks 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 تغییر می کند

  • Module structure has changed, splitting the library ( b/138451391 )
    • benchmark:benchmark-junit4 contains classes with JUnit dependency: AndroidBenchmarkRunner , and BenchmarkRule , both of which have moved into the androidx.benchmark.junit4 package
    • benchmark:benchmark-common contains 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

کمک های خارجی

  • Thanks to Sergey Zakharov for contributing JSON output improvements and the fix for screen off issues!

Version 1.0.0-alpha03

2 جولای 2019

androidx.benchmark:benchmark:1.0.0-alpha03 and androidx.benchmark:benchmark-gradle-plugin:1.0.0-alpha03 are released. commit های موجود در این نسخه را می توانید در اینجا بیابید.

ویژگی های جدید

  • 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

نسخه 1.0.0-alpha02

6 ژوئن 2019

androidx.benchmark:1.0.0-alpha02 and androidx.benchmark:benchmark-gradle-plugin:1.0.0-alpha02 are released. commit های موجود در این نسخه را می توانید در اینجا بیابید.

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 تغییر می کند

  • 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.reportData API ( b/132887006 )

رفع اشکال

  • Fixed ./gradlew lockClocks not sticking on some recent OS devices ( b/133424037 )
  • Throttling detection disabled for emulator ( b/132880807 )

نسخه 1.0.0-alpha01

7 مه 2019

androidx.benchmark:benchmark:1.0.0-alpha01 is released. The commits included in this version are available here .

،

معیار

Accurately measure your code's performance within Android Studio.
آخرین به روز رسانی انتشار پایدار کاندید را آزاد کنید نسخه بتا انتشار آلفا
9 آوریل 2025 1.3.4 - - 1.4.0-alpha11

اعلام وابستگی ها

To add a dependency on Benchmark, you must add the Google Maven repository to your project. برای اطلاعات بیشتر، مخزن Maven Google را بخوانید.

Macrobenchmark

To use Macrobenchmark in your project, add the following dependencies to your build.gradle file for your macrobenchmark module :

شیار

dependencies {
  androidTestImplementation "androidx.benchmark:benchmark-macro-junit4:1.3.4"
}

کاتلین

dependencies {
  androidTestImplementation("androidx.benchmark:benchmark-macro-junit4:1.3.4")
}

Microbenchmark

To use Microbenchmark in your project, add the following dependencies to your build.gradle file for your microbenchmark module :

شیار

dependencies {
    androidTestImplementation "androidx.benchmark:benchmark-junit4:1.3.4"
}

android {
    ...
    defaultConfig {
        ...
        testInstrumentationRunner "androidx.benchmark.junit4.AndroidBenchmarkRunner"
    }
}

کاتلین

dependencies {
    androidTestImplementation("androidx.benchmark:benchmark-junit4:1.3.4")
}

android {
    ...
    defaultConfig {
        ...
        testInstrumentationRunner = "androidx.benchmark.junit4.AndroidBenchmarkRunner"
    }
}

کتابخانه Microbenchmark همچنین یک پلاگین Gradle را برای استفاده با ماژول microbenchmark ارائه می دهد. این افزونه پیش‌فرض‌های پیکربندی ساخت را برای ماژول تنظیم می‌کند، نسخه خروجی معیار را برای میزبان تنظیم می‌کند و وظیفه ./gradlew lockClocks را ارائه می‌کند.

برای استفاده از این افزونه، خط زیر را در بلوک «plugins» در فایل build.gradle سطح بالای خود قرار دهید:

شیار

plugins {
  id 'androidx.benchmark' version '1.3.4' apply false
}

کاتلین

plugins {
  id("androidx.benchmark") version "1.3.4" apply false
}

سپس افزونه را در فایل build.gradle ماژول بنچمارک خود اعمال کنید

شیار

plugins {
  id 'androidx.benchmark'
}

کاتلین

plugins {
    id("androidx.benchmark")
}

بازخورد

بازخورد شما به بهتر شدن Jetpack کمک می کند. اگر مسائل جدیدی کشف کردید یا ایده هایی برای بهبود این کتابخانه دارید، به ما اطلاع دهید. لطفاً قبل از ایجاد کتابخانه جدید، به مسائل موجود در این کتابخانه نگاهی بیندازید. با کلیک کردن روی دکمه ستاره می توانید رای خود را به یک موضوع موجود اضافه کنید.

یک شماره جدید ایجاد کنید

برای اطلاعات بیشتر به مستندات ردیاب مشکل مراجعه کنید.

نسخه 1.4

Version 1.4.0-alpha11

9 آوریل 2025

androidx.benchmark:benchmark-*:1.4.0-alpha11 is released. Version 1.4.0-alpha11 contains these commits .

تغییرات API

  • Changed TraceProcessor 's argument timeout: Duration to timeoutMs long for Java caller usability. ( I9fbb5 )
  • Mark TraceProcessor constructor as internal. Callers should use TraceProcessor.startServer or TraceProcessor.runServer . ( Ia8c5b )

رفع اشکال

  • When killing the application with MacrobenchmarkScope.killProcess , validate the kill command results to prevent silent failure, and timeout error. ( I84555 )

به روز رسانی های وابستگی

  • This library now targets Kotlin 2.0 language level and requires KGP 2.0.0 or newer. ( Idb6b5 )

Version 1.4.0-alpha10

26 مارس 2025

androidx.benchmark:benchmark-*:1.4.0-alpha10 is released. Version 1.4.0-alpha10 contains these commits .

تغییرات API

  • Increased default timeout for TraceProcessor server load and querying to 120 seconds (from 60/30 previously), and made both configurable with one timeout parameter. ( Ifec87 )

رفع اشکال

  • Fixed a few issues that would occur when benchmarking or capturing profiles of an app without profileinstaller , and it's included BroadcastReciever . This only affects runs on rooted devices. ( Ied308 )

Version 1.4.0-alpha09

12 مارس 2025

androidx.benchmark:benchmark-*:1.4.0-alpha09 is released. Version 1.4.0-alpha09 contains these commits .

تغییرات API

  • Added TraceProcessor and Session API with closable Handles, for easier usage with custom lifecycles. This is also a step towards enabling easier Coroutine and Java API usage. The extension functions to TraceProcessor.runServer {} are now marked experimental, as they're likely to move, and be made non-experimental in the future. ( I358b4 )

رفع اشکال

  • Fixed Benchmark and Baseline Profile capture not working with API 36 due to a change in pgrep toybox that now requires -a to print the full command line. ( Idc991 )
  • Filter default tracing config to reduce risk of data loss in traces on newer API levels. ( I54e8a )
  • Added experimental androidx.benchmark.killExistingPerfettoRecordings instrumentation argument, which can be set to false to allow pre existing perfetto trace capture to continue. By default pre existing perfetto trace captures on device are killed to prevent interference. ( I02a3c )
  • The JSON field context.osCodenameAbbreviated will now be REL for released OS versions at and above API 35, as non-numeric code names are no longer supported by the underlying platform. ( Ib17fd )
  • Fixes crash in FrameTimingMetric when resynced frames occur. ( I7c6f4 , b/394610806 )
  • No longer assume Choreographer#doFrame is the top of the stack frame on the main thread for FrameTimingQuery . ( Iee0e0 , b/340206285 )

Version 1.4.0-alpha08

12 فوریه 2025

androidx.benchmark:benchmark-*:1.4.0-alpha08 is released. Version 1.4.0-alpha08 contains these commits .

تغییرات API

  • Moved TraceProcessor.runSession() extension APIs to be experimental, as they are likely to move to be concrete constructors eventually on Android. ( Ib0528 , b/393640753 )
  • Most of the implementation of Startup Insights are now public/experimental, and move to the TraceProcessor artifact See StartupInsights . ( I0aa00 )
  • Deprecate BenchmarkRule.runWithTimingDisabled {} in favor of BenchmarkRule.runWithMeasurementDisabled {} , which more clearly describes the behavior - all metrics are paused. Additionally, expose the MicrobenchmarkScope superclass since redeclaring the runWithMeasurementDisabled function to open access isn't possible, since it's inline. ( I9e23b , b/389149423 , b/149979716 )
  • Benchmark libraries have moved to Kotlin 2.0. ( I9d1e0 )
  • Removed androidx.benchmark.startupProfiles.enable instrumentation argument. It is no longer useful, as it can be controlled by includeInStartupProfile arg in BaselineProfileRule.collect() . ( I39eb4 )

رفع اشکال

  • Reduced the amount of Microbenchmark internal functions called during profiling to make eg Method traces more clear ( Ifaed8 )
  • Speculative fix for crashes: 'Failed to stop [ ProcessPid(processName=perfetto, pid=...) ]'. Now Benchmark will log a message instead of crashing when a background Perfetto process isn't able to be stopped before running the benchmark. ( I37d3e , b/323601788 )
  • Fix IllegalStateExceptions with 'Expected pm dump-profiles stdout' label that were caused by overly strict output format check. ( I358dc )

Version 1.4.0-alpha07

29 ژانویه 2025

androidx.benchmark:benchmark-*:1.4.0-alpha07 is released. Version 1.4.0-alpha07 contains these commits .

ویژگی های جدید

  • BaselineProfileRule now introduces a collectWithResults(...) API which includes a list of paths to the computed profiles. ( I056f8 )
  • Added androidx.benchmark.measureRepeatedOnMainThread.throwOnDeadline instrumentation argument, which can be set to false to disable the throw on deadline behavior of measureRepeatedOnMainThread for local testing. Not otherwise recommended, as this increases the likelihood of ANRs during tests. ( Idbeec , b/353226476 )

تغییرات API

  • Added @JvmOverloads to MicrobenchmarkConfig constructor. ( I13fd3 )
  • Refactored BenchmarkRule to be built on top of coroutines, and support better yield() behavior. This refactor removed several experimental BenchmarkState APIs, but will be followed by replacements as needed. Additionally, added runWithMeasurementDisabled to clarify behavior (all measurement is paused). In the future, runWithTimingDisabled will be deprecated. ( I19837 , b/389149423 , b/311242861 )
  • Move PerfettoTraceProcessor to TraceProcessor in a new androidx.benchmark:benchmark-traceprocessor artifact, and make most of its API non-experimental. Any custom TraceMetric or anything reading from traces will need to update to the new TraceProcessor import. The new TraceProcessor API works exactly like the old one, but is a standalone interface library (somewhat analogous to the androidx.sqlite layer from Room) with an Android-specific implementation built into macrobenchmark. The new artifact can be used on JVM as well, but currently you'll need to start your own copy of the TraceProcessor binary and offer a port to connect to it on. ( I3a767 , I62563 , b/381134564 )

رفع اشکال

  • Throw a clearer error message when MacrobenchmarkScope.startActivityAndWait fails to launch the target process (potentially due to a crash in the target process), instead of the more ambiguous 'Unable to confirm activity launch completion' message ( I3539b )
  • Fixed several syntax errors in Kotlin samples, and syntax highlighting in several Java / build.gradle samples. ( Ib3808 )
  • Clarified ArtMetric and CaptureInfo parameter docs. ( I96e60 )

Version 1.4.0-alpha06

11 دسامبر 2024

androidx.benchmark:benchmark-*:1.4.0-alpha06 is released. Version 1.4.0-alpha06 contains these commits .

تغییرات API

  • Removed usage of @Language("sql") in PerfettoTraceProcessor.Session.query() , as Studio highlighting/parsing is broken. ( Idc2fa , b/377733398 )

رفع اشکال

  • این کتابخانه اکنون از حاشیه‌نویسی‌های پوچ JSpecify استفاده می‌کند که نوع استفاده هستند. Kotlin developers should use the following compiler arguments to enforce correct usage: -Xjspecify-annotations=strict , -Xtype-enhancement-improvements-strict-mode ( I46810 , b/326456246 )
  • Corrected ArtMetric to report class load (not init), and improved docs to clarify runtime behavior. ( I9915c )
  • On Android Multiuser, execute commands as root only on rooted devices. ( I88b44 )

نسخه 1.4.0-alpha05

13 نوامبر 2024

androidx.benchmark:benchmark-*:1.4.0-alpha05 is released. Version 1.4.0-alpha05 contains these commits .

رفع اشکال

  • Fixed an issue on API 34+ where CompilationMode.None() would have inconsistent performance not representative of initial, worst case performance. This works around a platform change which allows ART's compilation state verify to partially compile apps (only affecting class loading) shortly after first launch. ( Ie48d0 )
  • Fixed issue where (especially short) traces could be captured that wouldn't report measurement from built-in Macrobenchmark Metrics, due to the process name being truncated within the Perfetto trace. Now macrobenchmark works around this issue by looking for the truncated package name in all built-in queries, in addition to the expected package name. Note that custom TraceMetric implementations or other direct callers of PerfettoSession.query can implement this same behavior by changing process.name LIKE "$packageName" in a Perfetto query to instead be (process.name LIKE "$packageName" OR process.name LIKE "$(packageName.takeLast(15))") . ( I5bf01 , b/377565760 )

نسخه 1.4.0-alpha04

30 اکتبر 2024

androidx.benchmark:benchmark-*:1.4.0-alpha04 is released. Version 1.4.0-alpha04 contains these commits .

ویژگی های جدید

  • (Experimental) Enable Baseline Profile generation, and benchmarking on apps installed to a secondary user, for example any app on headless Android Auto devices. This support has been tested in some scenarios, but let us know with a bug if it doesn't work for you. ( I9fcbe , b/356684617 , b/373641155 )

رفع اشکال

  • isProfileable is now always overridden in benchmark builds, and isDebuggable is also now always overridden in both benchmark and nonMinified (baseline profile capture) builds. ( I487fa , b/369213505 )
  • Fixes compilation detection on some physical devices prior to API 28 - affects json context.compilationMode , as well as behavior of androidx.benchmark.requireAot=true (which no longer incorrectly throws) ( Ic3e08 , b/374362482 )
  • In CpuEventCounter metrics, throw if invalid measurements are observed (eg instructions/cpucycles==0) ( I8c503 )

نسخه 1.4.0-alpha03

16 اکتبر 2024

androidx.benchmark:benchmark-*:1.4.0-alpha03 is released. Version 1.4.0-alpha03 contains these commits .

تغییرات API

  • Macrobenchmark : Adds ArtMetric , which can be used to inspect profile coverage or general Android RunTime performance. Captures number and total duration of JIT, class init (where available), and class verification. Additionally, changes CaptureInfo to include optional ART mainline version with default. ( I930f7 )
  • Add coefficientOfVariation to Benchmark JSON output to show stability within a given benchmark run. ( Ib14ea )

رفع اشکال

  • Fixed CollectBaselineProfileTask when AVD device has spaces in it. ( Ia0225 , b/371642809 )
  • Speculative fix for errors from StartupMode.COLD exceptions: Package <packagename> must not be running prior to cold start! . Now, MacrobenchmarkScope.killProcess() (including the one run before each iteration, used to implement StartupMode.COLD behavior) will wait to verify that the app's processes have all stopped running. ( I60aa6 , b/351582215 )
  • Fixed issue where UNLOCKED_ error would show up on some rooted emulators. ( Ic5117 )
  • این کتابخانه اکنون از حاشیه‌نویسی‌های پوچ JSpecify استفاده می‌کند که نوع استفاده هستند. Kotlin developers should use the following compiler arguments to enforce correct usage: -Xjspecify-annotations=strict , -Xtype-enhancement-improvements-strict-mode ( I7104f , b/326456246 )

نسخه 1.4.0-alpha02

2 اکتبر 2024

androidx.benchmark:benchmark-*:1.4.0-alpha02 is released. Version 1.4.0-alpha02 contains these commits .

تغییرات API

  • Moved Gradle tasks lockClocks and unlockClocks to be on benchmark projects, instead of available at the top level. This change was necessary as there is unfortunately no way to register these as top level actions without breaking project isolation. ( I02b8f , b/363325823 )

رفع اشکال

  • BaselineProfileRule now collects profiles for multi-process apps by signaling each running process at the end of the block to dump profiles. If a profile based compilation never successfully finds a process to broadcast to, the compilation will fail, as it's unexpected to have profile data within. Additionally, added an instrumentation argument to control dump wait duration: androidx.benchmark.saveProfileWaitMillis ( I0f519 , b/366231469 )
  • From Benchmark 1.3.2 : Fixed Firebase Test Lab (FTL) being unable to pull Baseline Profile or Macrobenchmark result files from the Baseline Profile Gradle Plugin. ( I2f678 , b/285187547 )

To use FTL apply the plugin to the baseline profile module in the plugin block, with:

  plugins {
      ...
      id("com.google.firebase.testlab")
  }

and then configure firebase test lab with:

  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}")
          }
      }
  }

Also the created FTL device needs to be added to the baseline profile extension:

  baselineProfile {
      managedDevices += "ftlDeviceShiba34"
      useConnectedDevices = false
  }

نسخه 1.4.0-alpha01

18 سپتامبر 2024

androidx.benchmark:benchmark-*:1.4.0-alpha01 is released. Version 1.4.0-alpha01 contains these commits .

New Feature - App Startup Insights

  • Initial version of app startup insights can be enabled in Macrobenchmark. ( 09fae38 )

To enable in a startup benchmark:

  @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(...)
      }
  }

Then running your startup benchmark will analyze the trace to look for common problems, and print them after metrics to Studio test output in the benchmark tab, eg:

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

This feature is still a work-in-progress, with improvements to documentation and extensibility to follow, but feedback is welcome.

ویژگی های جدید

  • Added gradle property androidx.baselineprofile.suppressWarnings to suppress all baseline profile warnings. ( 314153a )
  • Microbench metrics are now displayed in Perfetto traces as counters. ( 3214854 )
  • Add experimental scripts for disabling jit (requires root / runtime restart), and resetting device perf/test state. These are not currently published as gradle tasks. ( 7c3732b )
  • Added benchmark argument to skip tests when running on emulator. When automaticGenerationDuring build is enabled, benchmarks will also trigger baseline profile generation. This will fail, if emulators are used. With the new argument skipBenchmarksOnEmulator we can instead skip the test. ( 0c2ddcd )
  • Change perf event enable logic to run on API 23+ ( 2550048 )

تغییرات API

  • Existing experimental PerfettoConfig argument to MacrobenchmarkRule.measureRepeated() moved to the new ExperimentalConfig object.

رفع اشکال

  • Increase lockClocks.sh retry count ( 99e9dac )
  • Don't create nonMinified and benchmark build types if existing. Due to a bug, even if nonMinified and benchmark build types existed, they were going to be recreated. ( e75f0a5 )
  • Ignore non-terminating slices from TraceSectionMetric results. ( a927d20 )
  • Improved emulator check to consider sdk_ prefix. ( 1587de8 )
  • Treat non-running packages as cleared in FrameTimingGfxInfoMetric . ( 35cc79c )
  • Fix androidx.benchmark.cpuEventCounter producing corrupt values for non-Instruction events. ( 06edd59 )
  • Fix resumeTiming/runWithTimingDisabled to respect metric priority order, and significantly reduce impact of lower priority metric pause/resume on higher priority metric results. For example, if using cpu perf counters via cpuEventCounter.enable instrumentation argument, timeNs is no longer significantly reduced when pause/resume occur. ( 5de0968 )

نسخه 1.3

نسخه 1.3.4

26 مارس 2025

androidx.benchmark:benchmark-*:1.3.4 is released. Version 1.3.4 contains these commits .

رفع اشکال

  • Fixed Gradle Project Isolation incompatibilities in the Benchmark Baseline Gradle Plugin. ( b/404523257 )

نسخه 1.3.3

16 اکتبر 2024

androidx.benchmark:benchmark-*:1.3.3 is released. Version 1.3.3 contains these commits .

رفع اشکال

  • Fixed CollectBaselineProfileTask when AVD device has spaces in it ( Ia0225 , b/371642809 )

نسخه 1.3.2

2 اکتبر 2024

androidx.benchmark:benchmark-*:1.3.2 is released. Version 1.3.2 contains these commits .

رفع اشکال

  • Fixed Firebase Test Lab (FTL) being unable to pull Baseline Profile or Macrobenchmark result files from the Baseline Profile Gradle Plugin. ( I2f678 , b/285187547 )

To use FTL apply the plugin to the baseline profile module in the plugin block, with:

  plugins {
      ...
      id("com.google.firebase.testlab")
  }

and then configure firebase test lab with:

  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}")
          }
      }
  }

Also the created FTL device needs to be added to the baseline profile extension:

  baselineProfile {
      managedDevices += "ftlDeviceShiba34"
      useConnectedDevices = false
  }

نسخه 1.3.1

18 سپتامبر 2024

androidx.benchmark:benchmark-*:1.3.1 is released. Version 1.3.1 contains these commits .

رفع اشکال

  • Added gradle property androidx.baselineprofile.suppressWarnings to suppress all baseline profile warnings ( I7c36e , b/349646646 )
  • Fixed Baseline Profile Gradle Plugin to use pre-existing nonMinified… and benchmark… if created by the app instead of creating wrappers. ( Ia8934 , b/361370179 )
  • Fixed java.lang.AssertionError: ERRORS (not suppressed): EMULATOR when automaticGenerationDuringBuild is enabled on emulators. New argument is used to instead skip the test. ( If3f51 , b/355515798 )
  • Microbenchmark minification - keep subclasses of org.junit.runner.notification.RunListener in benchmark library proguard ( Ic8ed5 , b/354264743 )
  • Fix TraceSectionMetric to Ignore non-terminating slices. Previously these were considered to have -1 duration, eg during summation or finding minimum duration. ( If74b7 )
  • Fixed an issue in FrameTimingGfxInfoMetric where starting the metric would crash if the process wasn't already running. ( I6e412 )

نسخه 1.3.0

21 آگوست 2024

androidx.benchmark:benchmark-*:1.3.0 is released. Version 1.3.0 contains these commits .

Microbenchmark changes since 1.2.0

  • Method tracing is on by default in microbenchmarks when running on most devices
    • Method tracing runs as a separate phase, after measurements - this enables accurate measurements and method traces to both be output from a single benchmark run
    • Method tracing on some Android OS and ART versions will affect later measurement phases - on these versions, method tracing is off by default and a warning is printed to Studio output
  • Main thread benchmarks and ANRs
    • Added measureRepeatedOnMainThread for UI thread benchmarks (eg those that interact with Compose/View UIs) to avoid ANRs when running for many seconds.
    • Method traces are skipped if expected to overrun the ANR avoidance deadline. Set androidx.benchmark.profiling.skipWhenDurationRisksAnr to false to disable this behavior (not recommended for CI runs, as ANRs can cause problem in long CI runs).
  • کوچک سازی
    • Embedded proguard rules to improve microbenchmarking with minification enabled
    • Minification/R8 in a library module requires AGP 8.3, and can be enabled via android.buildTypes.release.androidTest.enableMinification in your build.gradle
    • Experimental BlackHole.consume() API added to prevent dead code elimination ( If6812 , b/286091643 )
  • معیارها
    • Experimental cpu event counter feature (metrics from perf_event_open , which requires root on most versions of the platform), access via InstrumentationArgument androidx.benchmark.cpuEventCounter.enable (can be set to true ), and androidx.benchmark.cpuEventCounter.events can be set eg to ( Instructions,CpuCycles ). This should be supported on some userdebug emulators, but support has not been tested across all available emulators

MACRObenchmark changes since 1.2.0

  • Method tracing overhaul for macrobenchmarks.
    • Now method traces are scoped to the duration of the measureBlock , and can capture multiple sessions if the process starts multiple times.
    • Previously, method tracing would only work for StartupMode.COLD benchmarks, and capture nothing for measureBlocks that didn't restart the target process
    • Fixed method traces flush in macrobenchmark, so that method traces should be fully captured and valid, even on slower devices. ( I6349a , b/329904950 )
  • Correctly dump ART profile during individual warmUp iterations when process is killed so CompilationMode.Partial(warmup=N) measurements are more accurate. ( I17923 )
  • Drop Shader broadcast failure message
    • Added debugging suggestions to drop shader broadcast failure message
    • Add two instrumentation arguments for overriding shader dropping behavior to workaround crashes when benchmarking apps without ProfileInstaller 1.3:
      • androidx.benchmark.dropShaders.enable=true/false : can be used to skip all shader dropping (including that done in StartupMode.Cold launches), 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 )
  • Added experimental MacrobenchmarkRule#measureRepeated variant which takes a custom PerfettoConfig for fully customized Perfetto trace recording. Note that incorrectly configured configs may cause built in Metric classes to fail. ( Idfd3d , b/309841164 , b/304038384 )
  • Cancel background dexopt jobs before running a Macrobenchmark to reduce interference. ( I989ed )
  • Macrobenchmark now waits for 1 second for the target application to flush an ART profile (previously it waited for 500 ms). ( I85a50 , b/316082056 )
  • TraceSectionMetric overhaul
    • Note : TraceSectionMetric changes below can affect outputs in CI usage, and may create discontinuities, or break parsing
    • Sum is now the default, as most usage of this metric is for repeated events, and first would discard data in these cases
    • Changed to be more customizable, with more available modes
    • Mode names are now embedded in metric output name (in Studio and JSON)
    • Now supports slices created using Trace.{begin|end}AsyncSection .
  • معیارها
    • Power - Added PowerMetric.deviceSupportsHighPrecisionTracking , PowerMetric.deviceBatteryHasMinimumCharge() and PowerMetric.deviceSupportsPowerEnergy()
    • Renamed Metric.getResult to getMeasurements to match return type
    • 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 )
    • Added frameCount measurement to FrameTimingMetric to aid in discovery of scenarios where measurements change because the number of frames produced changed (new animations added, invalidation issues fixed). ( I1e5aa )
    • Clarified that frameOverrunMs is the preferred metric for tracking when available in docs, and why. ( I18749 , b/329478323 )
    • 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 )
    • Improve FrameTimingMetric error when frames aren't produced, and always output link to trace when failing metric parsing to assist in diagnosing problem. ( I956b9 )
    • Fixed crash in FrameTimingMetric failing 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 )

Baseline Profile capture / Gradle plugin changes since 1.2.0

  • Increased max recommended version of AGP to 9.0.0-alpha01.
  • Ensure mergeArtProfile and mergeStartupProfile tasks always wait for baseline profile generation. ( I623d6 , b/343086054 )
  • Generating a baseline profile successfully will output a summary of what changed ( I824c8 , b/269484510 )
  • Added DSL to disable warnings ( Ic4deb , b/331237001 )
  • Fix to ensure benchmarks use generated baseline profiles when automaticGenerationDuringBuild is off ( Ic144f , b/333024280 )
  • Fix BaselineProfile gradle plugin property overrides to enable baseline profile generation and benchmarking when customizing a nonMinified or benchmark build type. ( Ib8f05 , b/324837887 )
  • 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 )

Other significant changes since 1.2.0

  • Trace capture
    • Reduced EXITCODE 2 error when starting perfetto from an error to logged warning
    • Enable AIDL tracing by default in benchmarks(requires API 28) ( Ia0af2 , b/341852305 )
    • Enable porter tag tracing by default in benchmarks. This captures, for example, wakelock tracepoints. ( Icfe44 , b/286551983 )
    • Increased trace capture start timeout to avoid crashes when starting tracing on slower devices ( I98841 , b/329145808 )
    • Added public API PerfettoTraceProcessor.Session.queryMetrics APIs with JSON, textproto, and proto binary (undecoded) variants. These allow you to query metrics built into TraceProcessor ( I54d7f , b/304038382 )
    • 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 )
  • خروجی JSON
    • 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 - Equals android.os.Build.ID
      • context.build.version.codename - Equals android.os.Build.VERSION.CODENAME
      • context.build.version.abbreviatedCodename - corresponds to first letter of pre-release codename (including on release builds) ( Ie5020 )
    • Added profilerOutput list to JSON output for easier tooling around profiling traces (eg Perfetto, Method traces) ( I05ddd , b/332604449 )
    • 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 )
    • Throw when filenames are longer than 200 chars to avoid unclear crashes when writing or post-processing files. ( I4a5ab )

نسخه 1.3.0-RC01

7 آگوست 2024

androidx.benchmark:benchmark-*:1.3.0-rc01 is released. Version 1.3.0-rc01 contains these commits .

رفع اشکال

  • Fix androidx.benchmark.cpuEventCounter producing corrupt values for non-Instruction events ( I7386a , b/286306579 )
  • Fix resumeTiming / runWithTimingDisabled to respect metric priority order, and significantly reduce impact of lower priority metric pause/resume on higher priority metric results. For example, if using cpu perf counters via cpuEventCounter.enable instrumentation argument, timeNs is no longer significantly reduced when pause/resume occur. ( I39c2e , b/286306579 , b/307445225 )
  • Reduced chance of stack sampling causing measureRepeatedOnMainThread from hitting main thread hard timeout by moving stack sampling conversion off main thread. ( I487a8 , b/342237318 )
  • Removed manual outlining of access to new platform APIs since this happens automatically via API modeling when using R8 with AGP 7.3 or later (eg R8 version 3.3) and for all builds when using AGP 8.1 or later (eg D8 version 8.1). Clients who are not using AGP are advised to update to D8 version 8.1 or later. برای جزئیات بیشتر به این مقاله مراجعه کنید. ( 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 )

نسخه 1.3.0-beta02

10 جولای 2024

androidx.benchmark:benchmark-*:1.3.0-beta02 is released. Version 1.3.0-beta02 contains these commits .

رفع اشکال

  • Gracefully handle EXITCODE 2 when starting Perfetto to log a warning, but proceed.

نسخه 1.3.0-beta01

12 ژوئن 2024

androidx.benchmark:benchmark-*:1.3.0-beta01 is released. Version 1.3.0-beta01 contains these commits .

تغییرات API

  • Renamed MethodTracing.affectsMeasurementOnThisDevice to AFFECTS_MEASUREMENT_ON_THIS_DEVICE for 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 via ProfilerConfig.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 - Equals android.os.Build.ID
    • context.build.version.codename - Equals android.os.Build.VERSION.CODENAME
    • context.build.version.abbreviatedCodename - corresponds to first letter of pre-release codename (even on release builds) ( Ie5020 )
  • Fixes StackSampling to respect androidx.benchmark.profiling.sampleDurationSeconds ( Ib1d53 )
  • Change macro->common dependency to be api() , so it's easier to use eg PerfettoTrace and PerfettoConfig . ( Icdae3 , b/341851833 )
  • Ensure mergeArtProfile and mergeStartupProfile tasks 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

14 مه 2024

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

1 مه 2024

androidx.benchmark:benchmark-*:1.3.0-alpha04 is released. Version 1.3.0-alpha04 contains these commits .

تغییرات API

  • Added experimental MacrobenchmarkRule#measureRepeated variant which takes a custom PerfettoConfig for 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.deviceSupportsPowerEnergy to PowerMetric.deviceSupportsHighPrecisionTracking for clarity ( I5b82f )
  • Added PowerMetric.deviceBatteryHasMinimumCharge() and PowerMetric.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 )

نسخه 1.3.0-alpha03

17 آوریل 2024

androidx.benchmark:benchmark-*:1.3.0-alpha03 is released. Version 1.3.0-alpha03 contains these commits .

ویژگی های جدید

  • Adds public API PerfettoTraceProcessor.Session.queryMetrics APIs with JSON, textproto, and proto binary (undecoded) variants. These allow you to query metrics built into TraceProcessor ( I54d7f , b/304038382 )
  • Added profilerOutput to 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

  • Changed TraceSectionMetric.Mode to sealed class to enable future expansion without breaking exhaustive when statements ( I71f7b )
  • Added TraceSectionMetric.Mode.Average and .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.getResult to getMeasurements to match return type ( I42595 )

رفع اشکال

  • Fix to ensure benchmarks use generated baseline profiles when automaticGenerationDuringBuild is off ( Ic144f , b/333024280 )
  • Fix BaselineProfile gradle plugin property overrides to enable baseline profile generation and benchmarking when customizing a nonMinified or 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 )
  • TraceSectionMetric now supports slices created using Trace.{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 frameCount measurement to FrameTimingMetric to aid in discovery of scenarios where measurements change because the number of frames produced changed (new animations added, invalidation issues fixed). ( I1e5aa )
  • Clarified that frameOverrunMs is the preferred metric for tracking when available in docs, and why. ( I18749 , b/329478323 )

نسخه 1.3.0-alpha02

20 مارس 2024

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 )

نسخه 1.3.0-alpha01

21 فوریه 2024

androidx.benchmark:benchmark-*:1.3.0-alpha01 is released. نسخه 1.3.0-alpha01 شامل این تعهدات است.

تغییرات API

  • Renamed MicrobenchmarkConfig boolean parameters to avoid unnecessary word 'should' ( Ia8f00 , b/303387299 )
  • Added BenchmarkRule.measureRepeatedOnMainThread so 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 of FrameTimingMetric with 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 warmUp iterations. ( I17923 )
  • Several changes to TraceSectionMetric API:
    • 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 )

رفع اشکال

  • 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 ProfileInstaller 1.3:
    • androidx.benchmark.dropShaders.enable=true/false : can be used to skip all shader dropping (including that done in StartupMode.Cold launches), 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 verification on 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-stop to kill apps when not a system app like System UI or Launcher. ( I5e028 )
  • Macrobenchmark now waits for 1 second for the target application to flush an ART profile (previously it waited for 500 ms ). ( I85a50 , b/316082056 )
  • Improve FrameTimingMetric error when frames aren't produced, and always output link to trace when failing metric parsing to assist in diagnosing problem. ( I956b9 )
  • Fixed crash in FrameTimingMetric failing 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 )

نسخه 1.2

نسخه 1.2.4

17 آوریل 2024

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 automaticGenerationDuringBuild in libraries causing a circular dependency. ( I28ab7 , b/333024280 )
  • Use am force-stop to kill apps when not a system app like System UI or Launcher. This fixes StartupMode.COLD benchmarks crashing from "Package $package must not be running prior to cold start!" due to process kill not fully succeeding. ( I5e028 )

نسخه 1.2.3

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.

نسخه 1.2.2

1 دسامبر 2023

androidx.benchmark:benchmark-*:1.2.2 is released. Version 1.2.2 contains these commits.

Baseline Profiles

نسخه 1.2.1

15 نوامبر 2023

androidx.benchmark:benchmark-*:1.2.1 is released. نسخه 1.2.1 شامل این تعهدات است.

ویژگی های جدید

نسخه 1.2.0

18 اکتبر 2023

androidx.benchmark:benchmark-*:1.2.0 is released. نسخه 1.2.0 شامل این تعهدات است.

تغییرات مهم از 1.1.0

Baseline Profiles

  • New Baseline Profile Gradle Plugin automates capturing and including baseline profiles in your test and build workflow.
  • BaselineProfileRule.collect now stable, a streamlined and simplified version of the previous experimental BaselineProfileRule.collectBaselineProfile API
    • Just specify packageName , and drive your app
  • For libraries generating baseline profiles, you can now filter the rules generated either in code ( BaselineProfileRule.collect argument), or even more simply in the gradle plugin
  • رفع می کند

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.enable instrumentation argument, (already available in microbenchmark) for quicker validation runs (eg when creating the benchmark, or in presubmit)
    • Support for androidx.benchmark.profiling.mode=StackSampling and MethodTracing .
    • Added androidx.benchmark.enabledRules to allow runtime filtering baseline profile vs macrobenchmark rule tests
    • Added androidx.benchmark.perfettoSdkTracing.enable argument to enable tracing with tracing-perfetto, eg Compose recomposition tracing. Note that when used with StartupMode.COLD , timing will be significantly affected as the tracing library is loaded and enabled during app startup.
  • الزامات

    • Macrobenchmark now requires ProfileInstaller 1.3.0 or greater in the target app, to enable profile capture / reset, and shader cache clearing.
  • New Experimental Metric APIs

  • رفع می کند

    • Fixed crashes when installing or extracting profiles from an app installed from multiple APKs (eg from app bundle).
    • Fixed FrameTimingMetric ignoring 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.COLD by consistently dropping the shader cache (also exposed via MacrobenchmarkScope.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.
  • APIهای آزمایشی
    • Added experimental MicrobenchmarkConfig API 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 BenchmarkState separately from BenchmarkRule , without JUnit
    • Added experimental PerfettoTrace record to enable capturing Perfetto traces, with custom configuration, separate from benchmark APIs.
  • رفع می کند
    • Workaround missing leading whitespaces in Android Studio benchmark output.
    • Fix issue where warnings could fail to print in Android Studio benchmark output.
    • Fixed SampledProfiling crash on Android 13 (API 33) and higher.
    • Massively improved performance of dryRunMode by skipping IsolationActivity and Perfetto tracing (Up to 10x faster dry run mode on older OS versions).

نسخه 1.2.0-RC02

6 اکتبر 2023

androidx.benchmark:benchmark-*:1.2.0-rc02 is released. نسخه 1.2.0-RC02 شامل این تعهدات است.

رفع اشکال

  • Fix Benchmark file output to no longer break BaselineProfile Plugin 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-perfetto loading error messages when injecting from macrobenchmark module into target application.

نسخه 1.2.0-RC01

20 سپتامبر 2023

androidx.benchmark:benchmark-*:1.2.0-rc01 is released. نسخه 1.2.0-RC01 شامل این تعهدات است.

رفع اشکال

  • 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

30 آگوست 2023

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

23 آگوست 2023

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 )

نسخه 1.2.0-beta03

9 آگوست 2023

androidx.benchmark:benchmark-*:1.2.0-beta03 is released. نسخه 1.2.0-beta03 شامل این تعهدات است.

تغییرات API

  • Added argument to filter TraceSectionMetric to only the target package, on by default ( Ia219b , b/292208786 )

رفع اشکال

  • Renamed fullTracing.enable instrumentation argument to perfettoSdkTracing.enable for consistency with artifact name, and other references. fullTracing.enable will 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 )

نسخه 1.2.0-beta02

26 جولای 2023

androidx.benchmark:benchmark-*:1.2.0-beta02 is released. نسخه 1.2.0-beta02 شامل این تعهدات است.

تغییرات API

  • 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.0 an api instead of an implementation dependency. ( I1981e )

نسخه 1.2.0-beta01

18 جولای 2023

androidx.benchmark:benchmark-*:1.2.0-beta01 is released. نسخه 1.2.0-beta01 شامل این تعهدات است.

رفع اشکال

  • 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 named frameDurationCpuMs . ( Ib097f , b/288830934 ).

Version 1.2.0-alpha16

21 ژوئن 2023

androidx.benchmark:benchmark-*:1.2.0-alpha16 is released. Version 1.2.0-alpha16 contains these commits.

تغییرات API

  • BaselineProfileRule.collectBaselineProfile() API has been renamed to BaselineProfileRule.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. MethodTracing trace sections are also now included in the captured Perfetto trace, if present. ( I9f657 , b/285014599 )
  • Add count measurement to TraceSectionMetric with Mode.Sum . ( Ic121a , b/264398606 )

Version 1.2.0-alpha15

7 ژوئن 2023

androidx.benchmark:benchmark-*:1.2.0-alpha15 is released. Version 1.2.0-alpha15 contains these commits.

ویژگی های جدید

  • Added experimental MemoryUsageMetric for 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

  • The collectBaselineProfile API always generates stable baseline profiles. The collectStableBaselineProfile API has been removed and collectBaselineProfile should be used instead. ( I17262 , b/281078707 )
  • Changed BaselineProfileRule 's filterPredicate arg to non-null, with a equivalent default value so that the default filter behavior is more clear in docs. ( I3816e )

رفع اشکال

  • Disable IsolationActivity and Perfetto tracing in dryRunMode to 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=StackSampling and androidx.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

3 مه 2023

androidx.benchmark:benchmark-*:1.2.0-alpha14 is released. Version 1.2.0-alpha14 contains these commits.

رفع اشکال

  • Fix FrameTimingMetric ignoring frames with inconsistent frame IDs. This would cause some animations on recent platform versions (API 31+) to ignore many frames while RenderThread was 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-profiles command. ( Id1392 , b/277645214 )
  • Fix GPU clock locking script to compare strings correctly ( I53e54 , b/213935715 )

Version 1.2.0-alpha13

5 آوریل 2023

androidx.benchmark:benchmark-*:1.2.0-alpha13 is released. Version 1.2.0-alpha13 contains these commits.

تغییرات API

  • Added profile type parameter when generating baseline profiles to support upcoming startup profile feature ( Ie20d7 , b/275093123 )
  • Added new experimental TraceMetric API 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

22 مارس 2023

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

  • Removed Perfetto tracing support on API 21 and 22, which includes both Microbenchmarks and the experimental PerfettoTrace APIs. Prior to this version, UiAutomation connections were unreliable on some devices. ( I78e8c )
  • Added public experimental API for PerfettoTraceProcessor to 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

8 مارس 2023

androidx.benchmark:benchmark-*:1.2.0-alpha11 is released. Version 1.2.0-alpha11 contains these commits.

رفع اشکال

  • Fixed crashes in MacrobenchmarkRule and BaselineProfileRule when reinstalling or extracting profiles from an app bundle with multiple APKs. ( I0d8c8 , b/270587281 )

Version 1.2.0-alpha10

22 فوریه 2023

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 DryRunMode to 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 PowerMetric crash when checking for powerstats presence on old API levels. ( 5faaf9 , b/268253898 )

Version 1.2.0-alpha09

11 ژانویه 2023

androidx.benchmark:benchmark-*:1.2.0-alpha09 is released. Version 1.2.0-alpha09 contains these commits.

رفع اشکال

  • Enabled passing None to androidx.benchmark.enabledRules instrumentation arg to disable all benchmarks / baseline profile generation. ( I3d7fd , b/258671856 )
  • Fix PerfettoTrace capture 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 )

نسخه 1.2.0-alpha08

7 دسامبر 2022

androidx.benchmark:benchmark-*:1.2.0-alpha08 is released. نسخه 1.2.0-alpha08 شامل این تعهدات است.

تغییرات API

  • Added experimental new APIs PerfettoTrace.record {} and PerfettoTraceRule to capture Perfetto traces (also known as System Traces) as part of a test, to inspect test behavior and performance. ( I3ba16 )
  • BaselineProfileRule now 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.collectStableBaselineProfile which 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 simpleperf trace 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>

نسخه 1.2.0-alpha07

9 نوامبر 2022

androidx.benchmark:benchmark-*:1.2.0-alpha07 is released. نسخه 1.2.0-alpha07 شامل این تعهدات است.

تغییرات API

  • Adds PowerMetric API 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 from StartupMode.COLD benchmarks, as shaders are now consistently cleared each iteration. Previously, Partial compilation 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 using profileinstaller:1.3.0-alpha02 in the target app. For ProfileInstaller library'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 metric inflateMs for the total time in a macrobenchmark spent on inflation. Also removed API 29 requirement, as TraceSectionMetric works together with androidx.tracing.Trace back to lower API levels, with the use of forceEnableAppTracing within 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 pull command, 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() where StartupMode.COLD wouldn't kill the target process after setupBlock . Now setupBlock interacting with the app will not leave the app process running, and an invalid cold start measurement. ( I8ebb7 )

نسخه 1.2.0-alpha06

24 اکتبر 2022

androidx.benchmark:benchmark-*:1.2.0-alpha06 is released. نسخه 1.2.0-alpha06 شامل این تعهدات است.

تغییرات API

  • BaselineProfileRule no 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 BaselineProfileRule or CompilationMode.Partial(warmupIterations) on an unrooted device, you must also update your target app to use androidx.profileinstaller.profileinstaller:1.3.0-alpha01 . This enables flushing the profile to disk correctly, so that it can be compiled/extracted.

رفع اشکال

نسخه 1.2.0-alpha05

5 اکتبر 2022

androidx.benchmark:benchmark-*:1.2.0-alpha05 is released. نسخه 1.2.0-alpha05 شامل این تعهدات است.

رفع اشکال

  • Fix frame breakdown in Studio system trace viewer for benchmark captured traces ( I3f3ae , b/239677443 )
  • Correct FrameTimingMetric to list FrameOverrun as 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 )

نسخه 1.2.0-alpha04

21 سپتامبر 2022

androidx.benchmark:benchmark-*:1.2.0-alpha04 is released. نسخه 1.2.0-alpha04 شامل این تعهدات است.

ویژگی های جدید

  • Add support for dryRunMode.enable instrumentation 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=true
    

    In build.gradle:

    android {
        defaultConfig {
            testInstrumentationRunnerArgument 'androidx.benchmark.dryRunMode.enable', 'true'
        }
    }
    

رفع اشکال

  • Fixed StartupTimingMetric to no longer require measured Activities to be launched through MacrobenchmarkScope.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 startActivityAndWait would timeout trying to wait for launch completion on emulators by reducing strictness of frame detection. ( Ibe2c6 , b/244594339 , b/228946895 )

نسخه 1.2.0-alpha03

7 سپتامبر 2022

androidx.benchmark:benchmark-*:1.2.0-alpha03 is released. نسخه 1.2.0-alpha03 شامل این تعهدات است.

ویژگی های جدید

  • Added experimental APIs for using BenchmarkState independently, separate from BenchmarkRule / JUnit4 . ( Id478f , b/228489614 )

رفع اشکال

نسخه 1.2.0-alpha02

24 آگوست 2022

androidx.benchmark:benchmark-*:1.2.0-alpha02 is released. نسخه 1.2.0-alpha02 شامل این تعهدات است.

تغییرات API

  • Default to am force stop for MacrobenchmarkScope.killProcess() , even when rooted, except during Baseline Profile generation. This can be overridden with an optional boolean argument. ( 02cce9 , b/241214097 )

رفع اشکال

نسخه 1.2.0-alpha01

27 جولای 2022

androidx.benchmark:benchmark-*:1.2.0-alpha01 is released. نسخه 1.2.0-alpha01 شامل این تعهدات است.

ویژگی های جدید

  • New tracing-perfetto-common component allowing tooling to enable Perfetto SDK tracing in an app that exposes it ( I2cc7f )
  • Added androidx.benchmark.enabledRules instrumentation 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 generating BaselineProfiles on 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

  • Added new PowerMetric for measuring energy and power tasks in benchmarks. ( I9f39b , b/220183779 )
  • Added a new compilation mode CompilationMode.Ignore to skip profile reset and compilation. ( Ibbcf8 , b/230453509 )
  • Added a new parameter to BaselineProfileRule#collectBaselineProfile to 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 UnsupportedOperationException was 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 TotalPowerMetric and TotalEnergyMetric for 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 )

نسخه 1.1.1

نسخه 1.1.1

9 نوامبر 2022

androidx.benchmark:benchmark-*:1.1.1 is released. نسخه 1.1.1 شامل این تعهدات است.

رفع اشکال

  • Fixes android.system.ErrnoException: open failed: EACCES which would occur on some Android11 (API 30)+ devices. This is a cherry-pick of a fix from 1.2.0-alpha01 . ( aosp/2072249 )

نسخه 1.1.0

نسخه 1.1.0

15 ژوئن 2022

androidx.benchmark:benchmark-*:1.1.0 is released. نسخه 1.1.0 شامل این تعهدات است.

  • This version is identical to androidx.benchmark:benchmark-*:1.1.0-rc03 .

تغییرات مهم از 1.0.0

نسخه 1.1.0-RC03

1 ژوئن 2022

androidx.benchmark:benchmark-*:1.1.0-rc03 is released. نسخه 1.1.0-RC03 شامل این تعهدات است.

رفع اشکال

Version 1.1.0-rc02

11 مه 2022

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 CompilationMode having 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=false
    
  • Made it possible to share a module between macrobenchmarks and baseline profile generating tests by adding androidx.benchmark.enabledRules instrumentation argument. Pass in 'Macrobenchmark', or 'BaselineProfile' to just run one type of test, eg when generating BaselineProfiles on 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
    

نسخه 1.1.0-rc01

20 آوریل 2022

androidx.benchmark:benchmark-*:1.1.0-rc01 is released. نسخه 1.1.0-RC01 شامل این تعهدات است.

رفع اشکال

  • 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

6 آوریل 2022

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 than Compilation.None() . ( 611ac9 ).

Version 1.1.0-beta05

23 مارس 2022

androidx.benchmark:benchmark-*:1.1.0-beta05 is released. Version 1.1.0-beta05 contains these commits.

رفع اشکال

نسخه 1.1.0-beta04

23 فوریه 2022

androidx.benchmark:benchmark-*:1.1.0-beta04 is released. نسخه 1.1.0-beta04 شامل این تعهدات است.

رفع اشکال

  • Fix missing metrics on Android 10, and NoSuchElementException caused by process names not being captured correctly in traces. ( Ib4c17 , b/218668335 )

  • Use PowerManager for 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 measureRepeated thread 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 of androidx.profileinstaller and Android Gradle Plugin. aosp/1977029

نسخه 1.1.0-beta03

9 فوریه 2022

androidx.benchmark:benchmark-*:1.1.0-beta03 is released. نسخه 1.1.0-beta03 شامل این تعهدات است.

تغییرات API

  • Added AudioUnderrunMetric into macrobenchmark library under experimental flag to allow detection of audio underruns ( Ib5972 )
  • BaselineProfileRule no longer accepts a setup block as this functioned the same as the profileBlock . ( Ic7dfe , b/215536447 )

    برای مثال

    @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 -> FrameDurationUi to clarify these are durations, not timestamps, and to match prefixes. ( I0eba3 , b/216337830 )

نسخه 1.1.0-beta02

26 ژانویه 2022

androidx.benchmark:benchmark-*:1.1.0-beta02 is released. نسخه 1.1.0-beta02 شامل این تعهدات است.

رفع اشکال

  • 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 pull command in logcat and Studio output for pulling generated BaselineProfile text file. ( f08811 )

نسخه 1.1.0-beta01

12 ژانویه 2022

androidx.benchmark:benchmark-*:1.1.0-beta01 is released. نسخه 1.1.0-beta01 شامل این تعهدات است.

رفع اشکال

  • Fixes profiler argument enable being ignored. ( I37373 , b/210619998 )
  • Removed deprecated CompliationModes ( I98186 , b/213467659 )
  • Switched baseline profile arg of CompilationMode.Partial to enum for clarity. ( Id67ea )

Version 1.1.0-alpha13

15 دسامبر 2021

androidx.benchmark:benchmark-*:1.1.0-alpha13 is released. Version 1.1.0-alpha13 contains these commits.

تغییرات API

  • 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.Trace or androidx.tracing Jetpack 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 CompilationModes into 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 null in certain warmup scenarios). ( Id3b68 , b/208357448 , b/208369635 )

رفع اشکال

  • Fixed CompilationMode.Speed incorrectly treated as None ( I01137 )

Version 1.1.0-alpha12

17 نوامبر 2021

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

3 نوامبر 2021

androidx.benchmark:benchmark-*:1.1.0-alpha11 is released. Version 1.1.0-alpha11 contains these commits.

تغییرات API

  • Macrobenchmark now has a minSdkVersion of 23 . ( If2655 )
  • Adds a new experimental BaselineProfileRule which 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

27 اکتبر 2021

androidx.benchmark:benchmark-*:1.1.0-alpha10 is released. Version 1.1.0-alpha10 contains these commits.

تغییرات API

  • 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

13 اکتبر 2021

androidx.benchmark:benchmark-*:1.1.0-alpha09 is released. Version 1.1.0-alpha09 contains these commits.

رفع اشکال

Version 1.1.0-alpha08

29 سپتامبر 2021

androidx.benchmark:benchmark-*:1.1.0-alpha08 is released. Version 1.1.0-alpha08 contains these commits.

تغییرات API

  • 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

1 سپتامبر 2021

androidx.benchmark:benchmark-*:1.1.0-alpha07 is released. Version 1.1.0-alpha07 contains these commits.

تغییرات API

  • 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 ProfileInstaller to make it easier for apps using baseline profiles to run MacroBenchmarks using CompilationMode.BaselineProfile . ( I42657 , b/196074999 ) NOTE: requires also updating to androidx.profileinstaller:profileinstaller:1.1.0-alpha04 or greater.
  • StartupMode.COLD + CompilationMode.None benchmarks are now more stable. ( I770cd , b/196074999 )

نسخه 1.1.0-alpha06

18 آگوست 2021

androidx.benchmark:benchmark-*:1.1.0-alpha06 is released. نسخه 1.1.0-alpha06 شامل این تعهدات است.

تغییرات API

  • Added androidx.benchmark.iterations instrumentation 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.BaselineProfile is a work in progress. Avoid using it to determine how good a profile is for now.

نسخه 1.1.0-alpha05

4 آگوست 2021

androidx.benchmark:benchmark-*:1.1.0-alpha05 is released. نسخه 1.1.0-alpha05 شامل این تعهدات است.

1.1.0-alpha04 was cancelled before release due to a sporatic crash. b/193827052

تغییرات API

  • 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 EmptyActivity to bring the target app out of a force-stopped state to better support CompilationMode.BaselineProfile . ( Id7cac , b/192084204 )
  • Changed trace file extension to .perfetto-trace to 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 )

نسخه 1.1.0-alpha03

16 ژوئن 2021

androidx.benchmark:benchmark-*:1.1.0-alpha03 is released. نسخه 1.1.0-alpha03 شامل این تعهدات است.

ویژگی های جدید

رفع اشکال

  • 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.

    به عنوان مثال،

    testInstrumentationRunnerArguments["androidx.benchmark.suppressErrors"] = "EMULATOR,LOW-BATTERY"
    

نسخه 1.1.0-alpha02

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. نسخه 1.1.0-alpha02 شامل این تعهدات است.

ویژگی های جدید

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 )

نسخه 1.1.0-alpha01

10 ژوئن 2020

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. نسخه 1.1.0-alpha01 شامل این تعهدات است.

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:
    • testBuildType is 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.debug is 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 InstrumentationResultParser error 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.

نسخه 1.0.0

Benchmark Version 1.0.0

20 نوامبر 2019

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 .

ویژگی های اصلی 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

نسخه 1.0.0-RC01

23 اکتبر 2019

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

نسخه 1.0.0-beta01

9 اکتبر 2019

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. نسخه 1.0.0-beta01 حاوی این تعهدات است .

ویژگی های جدید

  • 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-lint dependency, 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 additionalTestOutputDir instrumentation 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

18 سپتامبر 2019

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 تغییر می کند

  • The experimental annotation ExperimentalAnnotationReport is now correctly public. Usage of the experimental BenchmarkState#report API now requires this annotation

نسخه 1.0.0-alpha05

5 سپتامبر 2019

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. commit های موجود در این نسخه را می توانید در اینجا بیابید.

API تغییر می کند

  • BenchmarkState.reportData API is now marked experimental

رفع اشکال

  • Fix for the clock-locking script, which would fail on devices that were either missing the cut or expr shell utilities.
  • Fixed an issue with ./gradlew lockClocks task that would hang on devices that were rooted with an older version of the su utility, which did not support the -c flag.

نسخه 1.0.0-alpha04

7 آگوست 2019

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. commit های موجود در این نسخه را می توانید در اینجا بیابید.

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
    • Now automatically disables test coverage, and sets the AndroidBenchmarkRunner by default ( b/138374050 )
    • Added support for new AGP-based data copy, when running benchmarks and when using AGP 3.6+
  • JSON format additions
    • Output total benchmark test run time ( b/133147694 )
    • @Parameterized benchmarks 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 تغییر می کند

  • Module structure has changed, splitting the library ( b/138451391 )
    • benchmark:benchmark-junit4 contains classes with JUnit dependency: AndroidBenchmarkRunner , and BenchmarkRule , both of which have moved into the androidx.benchmark.junit4 package
    • benchmark:benchmark-common contains 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

کمک های خارجی

  • Thanks to Sergey Zakharov for contributing JSON output improvements and the fix for screen off issues!

Version 1.0.0-alpha03

2 جولای 2019

androidx.benchmark:benchmark:1.0.0-alpha03 and androidx.benchmark:benchmark-gradle-plugin:1.0.0-alpha03 are released. commit های موجود در این نسخه را می توانید در اینجا بیابید.

ویژگی های جدید

  • 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

نسخه 1.0.0-alpha02

6 ژوئن 2019

androidx.benchmark:1.0.0-alpha02 and androidx.benchmark:benchmark-gradle-plugin:1.0.0-alpha02 are released. commit های موجود در این نسخه را می توانید در اینجا بیابید.

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 تغییر می کند

  • 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.reportData API ( b/132887006 )

رفع اشکال

  • Fixed ./gradlew lockClocks not sticking on some recent OS devices ( b/133424037 )
  • Throttling detection disabled for emulator ( b/132880807 )

نسخه 1.0.0-alpha01

7 مه 2019

androidx.benchmark:benchmark:1.0.0-alpha01 is released. The commits included in this version are available here .