{"id":413228,"date":"2024-06-29T23:00:10","date_gmt":"2024-06-29T23:00:10","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=413228"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=413228","title":{"rendered":"<span>Android Vitals \u2014 \u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438?<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/855\/8b9\/9df\/8558b99df65d811402de3cb99e6f64fa.png\" width=\"780\" height=\"439\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/855\/8b9\/9df\/8558b99df65d811402de3cb99e6f64fa.png\"\/><figcaption><\/figcaption><\/figure>\n<p>\u0412\u0447\u0435\u0440\u0430 \u0443 \u043c\u0435\u043d\u044f \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u0438\u0434\u0435\u044f:<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/61a8cd3cabb378f6450d1ad9\" data-style=\"\" id=\"61a8cd3cabb378f6450d1ad9\" width=\"\"><\/div>\n<p>\u041a\u043e\u043c\u0443-\u043d\u0438\u0431\u0443\u0434\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430 \u0441\u0435\u0440\u0438\u044f \u0441\u0442\u0430\u0442\u0435\u0439, \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u043d\u0430\u044f \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0443 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 Android \u0432 \u044d\u043a\u0441\u043f\u043b\u0443\u0430\u0442\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0440\u0435\u0434\u0435?<\/p>\n<p>\u041d\u0435 \u0447\u0442\u043e-\u0442\u043e \u0442\u0438\u043f\u0430 &#171;\u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c Firebase Performance Monitoring&#187; (\u0447\u0442\u043e \u043c\u0435\u043d\u044f \u043d\u0435 \u043e\u0441\u043e\u0431\u043e \u0432\u043e\u043e\u0434\u0443\u0448\u0435\u0432\u043b\u044f\u0435\u0442), \u0430 \u0441\u043a\u043e\u0440\u0435\u0435 &#171;\u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 Android&#187;.<\/p>\n<p>\u201c\u042f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0435\u0440\u0432\u044b\u0439 onDraw \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438, \u043d\u043e \u043e\u043d \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430 API 25. \u041c\u043d\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u043b\u043e\u0441\u044c \u043a\u0430\u043a\u043e\u0435-\u0442\u043e \u0432\u0440\u0435\u043c\u044f, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c \u043f\u0440\u0438\u0447\u0438\u043d\u0443!\u201d<\/p>\n<p>\u041d\u0430 \u0447\u0442\u043e \u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043e\u0442\u0437\u044b\u0432\u044b \u0438 \u0441\u0440\u0430\u0437\u0443 \u0440\u0435\u0448\u0438\u043b \u043d\u0430\u0447\u0430\u0442\u044c \u043f\u0438\u0441\u0430\u0442\u044c. \u042d\u0442\u0430 \u0441\u0435\u0440\u0438\u044f \u0441\u0442\u0430\u0442\u0435\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u0430 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0443 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438 \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 Android \u0432 \u044d\u043a\u0441\u043f\u043b\u0443\u0430\u0442\u0430\u0446\u0438\u0438. \u041e\u043d\u0430 \u043e\u0437\u0430\u0433\u043b\u0430\u0432\u043b\u0435\u043d\u0430 Android Vitals \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u043d\u0430 \u0442\u0435\u0441\u043d\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u0430 \u0441 <a href=\"https:\/\/developer.android.com\/topic\/performance\/vitals\"><u>Android vitals<\/u><\/a> \u043e\u0442 \u0441\u0430\u043c\u0438\u0445 Google:<\/p>\n<blockquote>\n<p>Android vitals \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u0442\u0438\u0432\u043e\u0439 Google, \u043d\u0430\u0446\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u043d\u0430 \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438 \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u0438 Android-\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432. \u041a\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c, \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0432\u0448\u0438\u0439 \u0441\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0432\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0435\u0433\u043e Android-\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0435\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0431\u0430\u0442\u0430\u0440\u0435\u0438, \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430 \u0438 \u043e\u0442\u043a\u0430\u0437\u0430\u0445 \u0432 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f\u0445.<\/p>\n<\/blockquote>\n<p>\u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0438\u043b\u0438 \u0438\u0434\u0435\u0438 \u0434\u043b\u044f \u0431\u0443\u0434\u0443\u0449\u0438\u0445 \u0441\u0442\u0430\u0442\u0435\u0439, \u043d\u0435 \u0441\u0442\u0435\u0441\u043d\u044f\u0439\u0442\u0435\u0441\u044c \u043f\u0438\u0441\u0430\u0442\u044c \u043c\u043d\u0435 \u0432 <a href=\"https:\/\/twitter.com\/Piwai\"><u>Twitter<\/u><\/a>!<\/p>\n<p>\u0414\u043b\u044f \u0440\u0430\u0437\u043e\u0433\u0440\u0435\u0432\u0430 \u043d\u0430\u0447\u043d\u0443 \u0441 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u0430:<\/p>\n<h2>\u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438?<\/h2>\n<p>\u0427\u0442\u043e\u0431\u044b \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u0440\u044f\u0442\u044c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u044b, \u0442\u043e \u0435\u0441\u0442\u044c \u0440\u0430\u0437\u043d\u0438\u0446\u0443 \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u043c\u043e\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438. JDK \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u0430\u043c 2 \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f:<\/p>\n<pre><code class=\"java\">\/\/ \u041c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434\u044b \u0441 \u201c\u044d\u043f\u043e\u0445\u0438 Unix\u201d (00:00:00 UTC 1 \u044f\u043d\u0432\u0430\u0440\u044f 1970 \u0433.) System.currentTimeMillis() \/\/ \u041d\u0430\u043d\u043e\u0441\u0435\u043a\u0443\u043d\u0434\u044b \u0441 \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b. System.nanoTime() Android \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043a\u043b\u0430\u0441\u0441 SystemClock, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0435\u0449\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432: \/\/ (API 29) \u0422\u0430\u0439\u043c\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u0435\u0434\u0435\u0442 \u043e\u0442\u0441\u0447\u0435\u0442 \u0441 \u201c\u044d\u043f\u043e\u0445\u0438 Unix\u201d. \/\/ \u0421\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430 \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430. SystemClock.currentGnssTimeClock() \/\/ \u041c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u043f\u043e\u0442\u043e\u043a\u0435. SystemClock.currentThreadTimeMillis() \/\/ \u041c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434\u044b \u0441 \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0432\u0440\u0435\u043c\u044f, \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0435 \u0432 \u0441\u043f\u044f\u0449\u0435\u043c \u0440\u0435\u0436\u0438\u043c\u0435. SystemClock.elapsedRealtime() \/\/ \u041d\u0430\u043d\u043e\u0441\u0435\u043a\u0443\u043d\u0434\u044b \u0441 \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0432\u0440\u0435\u043c\u044f, \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0435 \u0432 \u0441\u043f\u044f\u0449\u0435\u043c \u0440\u0435\u0436\u0438\u043c\u0435. SystemClock.elapsedRealtimeNanos() \/\/ \u041c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434\u044b \u0441 \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438, \u043d\u0435 \u0441\u0447\u0438\u0442\u0430\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0433\u043e \u0432 \u0433\u043b\u0443\u0431\u043e\u043a\u043e\u043c \u0441\u043d\u0435. SystemClock.uptimeMillis()<\/code><\/pre>\n<p>\u0427\u0442\u043e \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u043c\u043d\u043e\u0433\u043e\u043e\u0431\u0440\u0430\u0437\u0438\u044f \u0432\u044b\u0431\u0440\u0430\u0442\u044c? \u041e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u043d\u0430 \u044d\u0442\u043e\u0442 \u0432\u043e\u043f\u0440\u043e\u0441 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u043e\u0447\u044c <a href=\"https:\/\/developer.android.com\/reference\/android\/os\/SystemClock\"><u>javadoc<\/u><\/a> \u043f\u043e <code>SystemClock<\/code>:<\/p>\n<pre><code class=\"java\">\/\/ (API 29) Clock that starts at Unix epoch. \/\/ Synchronized using the device's location provider. SystemClock.currentGnssTimeClock() \/\/ Milliseconds running in the current thread. SystemClock.currentThreadTimeMillis() \/\/ Milliseconds since boot, including time spent in sleep. SystemClock.elapsedRealtime() \/\/ Nanoseconds since boot, including time spent in sleep. SystemClock.elapsedRealtimeNanos() \/\/ Milliseconds since boot, not counting time spent in deep sleep. SystemClock.uptimeMillis()<\/code><\/pre>\n<ul>\n<li>\n<p><a href=\"https:\/\/developer.android.com\/reference\/java\/lang\/System#currentTimeMillis()\"><u>System#currentTimeMillis<\/u><\/a> \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u0438\u043b\u0438 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u043d\u043e\u0439 \u0441\u0435\u0442\u044c\u044e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u0440\u0435\u043c\u044f \u043c\u043e\u0436\u0435\u0442 \u043d\u0435\u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u043e \u043f\u0440\u044b\u0433\u0430\u0442\u044c \u043d\u0430\u0437\u0430\u0434 \u0438\u043b\u0438 \u0432\u043f\u0435\u0440\u0435\u0434. \u041f\u0440\u0438 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f\u0445 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u043e\u0432 \u0438\u043b\u0438 \u043f\u0440\u043e\u0448\u0435\u0434\u0448\u0435\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u043e\u0439 \u0442\u0430\u0439\u043c\u0435\u0440.<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p><a href=\"https:\/\/developer.android.com\/reference\/android\/os\/SystemClock#uptimeMillis()\"><u>SystemClock#uptimeMillis<\/u><\/a> \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f, \u043a\u043e\u0433\u0434\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442 \u0432 \u0440\u0435\u0436\u0438\u043c \u0433\u043b\u0443\u0431\u043e\u043a\u043e\u0433\u043e \u0441\u043d\u0430. \u041e\u043d \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0441\u043d\u043e\u0432\u043e\u0439 \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0439 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u043e\u0432 \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 Thread#sleep(long), Object#wait(long) (\u044d\u0442\u043e \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u0438 System#nanoTime). \u042d\u0442\u043e\u0442 \u0442\u0430\u0439\u043c\u0435\u0440 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u043e\u0432, \u043a\u043e\u0433\u0434\u0430 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b \u043d\u0435 \u0437\u0430\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0441\u043f\u044f\u0449\u0438\u0439 \u0440\u0435\u0436\u0438\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430.<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p><a href=\"https:\/\/developer.android.com\/reference\/android\/os\/SystemClock#elapsedRealtime()\"><u>SystemClock#elapsedRealtime<\/u><\/a> \u0438 <a href=\"https:\/\/developer.android.com\/reference\/android\/os\/SystemClock#elapsedRealtimeNanos()\"><u>SystemClock#elapsedRealtimeNanos<\/u><\/a> \u0437\u0430\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u044e\u0442 \u0438 \u0433\u043b\u0443\u0431\u043e\u043a\u0438\u0439 \u0441\u043e\u043d. \u042d\u0442\u0438 \u0442\u0430\u0439\u043c\u0435\u0440\u044b \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u043c\u043e\u0439 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u0439 \u043e\u0441\u043d\u043e\u0432\u043e\u0439 \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u043e\u0432.<\/p>\n<\/li>\n<\/ul>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0435 \u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 \u0433\u043b\u0443\u0431\u043e\u043a\u043e\u043c \u0441\u043d\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u0448\u0438 \u043b\u0443\u0447\u0448\u0438\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b &#8212; <code>SystemClock.uptimeMillis()<\/code> \u0438 <code>System.nanoTime()<\/code>.<\/p>\n<h2>uptimeMillis() \u0438\u043b\u0438 nanoTime()?<\/h2>\n<p><code>System.nanoTime()<\/code> \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0447\u0435\u043d, \u0447\u0435\u043c <code>uptimeMillis()<\/code>, \u043d\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u044d\u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043c\u0438\u043a\u0440\u043e\u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u043e\u0432. \u041f\u0440\u0438 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432 \u044d\u043a\u0441\u043f\u043b\u0443\u0430\u0442\u0430\u0446\u0438\u0438 \u043d\u0430\u043c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0432 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445.<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u0440\u0430\u0432\u043d\u0438\u043c \u0438\u0445 \u0432\u043b\u0438\u044f\u043d\u0438\u0435 \u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c. \u042f \u043a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043b \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 <a href=\"https:\/\/github.com\/android\/performance-samples\"><u>Android Benchmark Samples<\/u><\/a> \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0442\u0435\u0441\u0442:<\/p>\n<pre><code class=\"java\">@LargeTest @RunWith(AndroidJUnit4::class) class TimingBenchmark {     @get:Rule     val benchmarkRule = BenchmarkRule()      @Test     fun nanoTime() {         benchmarkRule.measureRepeated {             System.nanoTime()         }     }      @Test     fun uptimeMillis() {         benchmarkRule.measureRepeated {             SystemClock.uptimeMillis()         }     } }<\/code><\/pre>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043d\u0430 Pixel 3 \u043f\u043e\u0434 Android 10:<\/p>\n<ul>\n<li>\n<p><code>System.nanoTime()<\/code> \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f: 208 \u043d\u0441<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p><code>SystemClock.uptimeMillis()<\/code> \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f: 116 \u043d\u0441<\/p>\n<\/li>\n<\/ul>\n<p><code>SystemClock.uptimeMillis()<\/code> \u043f\u043e\u0447\u0442\u0438 \u0432 \u0434\u0432\u0430 \u0440\u0430\u0437\u0430 \u0431\u044b\u0441\u0442\u0440\u0435\u0435! \u0425\u043e\u0442\u044f \u044d\u0442\u0430 \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u0430 \u0438\u043c\u0435\u0442\u044c \u0441\u043a\u043e\u043b\u044c\u043a\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u0437\u043d\u0430\u0447\u0438\u043c\u043e\u0433\u043e \u0432\u043b\u0438\u044f\u043d\u0438\u044f \u043d\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043c\u043e\u0436\u0435\u043c \u043b\u0438 \u043c\u044b \u043f\u043e\u043d\u044f\u0442\u044c, \u043f\u043e\u0447\u0435\u043c\u0443 \u043e\u043d \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435?<\/p>\n<h3>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f uptimeMillis()<\/h3>\n<p><code>SystemClock.uptimeMillis()<\/code> \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u043a\u0430\u043a \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434, \u0430\u043d\u043d\u043e\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 <code>@CriticalNative<\/code>. <a href=\"https:\/\/cs.android.com\/android\/platform\/superproject\/+\/master:libcore\/dalvik\/src\/main\/java\/dalvik\/annotation\/optimization\/CriticalNative.java;l=99;drc=1a6015c8486695c938e1315403965e19997eaed8\"><u>CriticalNative<\/u><\/a> \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 \u0431\u044b\u0441\u0442\u0440\u044b\u0435 JNI-\u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u043b\u044f \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432.<\/p>\n<pre><code class=\"java\">public final class SystemClock {     @CriticalNative     native public static long uptimeMillis(); }<\/code><\/pre>\n<p>(<a href=\"https:\/\/cs.android.com\/android\/platform\/superproject\/+\/master:frameworks\/base\/core\/java\/android\/os\/SystemClock.java;l=178;drc=bc3d8b9071d4f0b2903d6836770d974e70366290\"><u>\u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a<\/u><\/a>)<\/p>\n<p>\u041d\u0430\u0442\u0438\u0432\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 <code>SystemClock.cpp<\/code>:<\/p>\n<pre><code class=\"java\">int64_t uptimeMillis() {     int64_t when = systemTime(SYSTEM_TIME_MONOTONIC);     return (int64_t) nanoseconds_to_milliseconds(when); }<\/code><\/pre>\n<p>(<a href=\"https:\/\/cs.android.com\/android\/platform\/superproject\/+\/master:system\/core\/libutils\/SystemClock.cpp;l=40-44;drc=bab16584ce0525742b5370682c9132b2002ee110\"><u>\u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a<\/u><\/a>)<\/p>\n<p><code>systemTime()<\/code> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d \u0432 <code>Timers.cpp<\/code>:<\/p>\n<pre><code class=\"java\">nsecs_t systemTime(int clock) {     static constexpr clockid_t clocks[] = {         CLOCK_REALTIME,         CLOCK_MONOTONIC,         CLOCK_PROCESS_CPUTIME_ID,         CLOCK_THREAD_CPUTIME_ID,         CLOCK_BOOTTIME     };     timespec t = {};     clock_gettime(clocks[clock], &amp;t);     return nsecs_t(t.tv_sec)*1000000000LL + t.tv_nsec; }<\/code><\/pre>\n<p>(<a href=\"https:\/\/cs.android.com\/android\/platform\/superproject\/+\/master:system\/core\/libutils\/Timers.cpp;l=35-44;drc=842e1cc17efca17f4a91b0bc678b39a1b1b43da4\"><u>\u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a<\/u><\/a>)<\/p>\n<h3>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f nanoTime()<\/h3>\n<p><code>System.nanoTime()<\/code> \u0442\u0430\u043a\u0436\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u043a\u0430\u043a \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434, \u0430\u043d\u043d\u043e\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 <code>@CriticalNative<\/code>.<\/p>\n<pre><code class=\"java\">public final class System {     @CriticalNative     public static native long nanoTime(); }<\/code><\/pre>\n<p>(<a href=\"https:\/\/cs.android.com\/android\/platform\/superproject\/+\/master:libcore\/ojluni\/src\/main\/java\/java\/lang\/System.java;l=345;drc=972664ff05e2531e8b37b572b3fb310077999868\"><u>\u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a<\/u><\/a>)<\/p>\n<p>\u041d\u0430\u0442\u0438\u0432\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 <code>System.c:<\/code><\/p>\n<pre><code class=\"java\">static jlong System_nanoTime() {   struct timespec now;   clock_gettime(CLOCK_MONOTONIC, &amp;now);   return now.tv_sec * 1000000000LL + now.tv_nsec; }<\/code><\/pre>\n<p>(<a href=\"https:\/\/cs.android.com\/android\/platform\/superproject\/+\/master:libcore\/ojluni\/src\/main\/native\/System.c;l=254-258;drc=c5f1494e3f0cdf6333bd0ba26bfac68da62e52d4\"><u>\u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a<\/u><\/a>)<\/p>\n<p>\u0414\u0432\u0435 \u044d\u0442\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436\u0438, \u043e\u043d\u0438 \u043e\u0431\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0442 <code>clock_gettime()<\/code>.<\/p>\n<p>\u041e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, <code>@CriticalNative<\/code> \u0442\u043e\u043b\u044c\u043a\u043e <a href=\"https:\/\/cs.android.com\/android\/_\/android\/platform\/libcore\/+\/b3d1a7e9d8b92b5d3295a995c10836b769fa2600\"><u>\u043d\u0435\u0434\u0430\u0432\u043d\u043e \u0431\u044b\u043b\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430<\/u><\/a> \u0432 <code>System.nanoTime()<\/code>, \u0447\u0442\u043e \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0435\u0442, \u043f\u043e\u0447\u0435\u043c\u0443 \u043e\u043d \u0431\u044b\u043b \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435!<\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u041f\u0440\u0438 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f:<\/p>\n<ul>\n<li>\n<p>\u0420\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0432 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 \u0441\u043b\u0443\u0447\u0430\u0435\u0432.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 <code>SystemClock.uptimeMillis()<\/code> \u0438\u043b\u0438 <code>System.nanoTime()<\/code>. \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435 \u043d\u0430 \u0441\u0442\u0430\u0440\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 Android, \u043d\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u044d\u0442\u043e \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u043e\u0441\u043e\u0431\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>\u042f \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0438\u0442\u0430\u044e <code>SystemClock.uptimeMillis()<\/code>, \u0442\u0430\u043a \u043a\u0430\u043a \u043c\u043d\u0435 \u043f\u0440\u043e\u0449\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434\u044b.<\/p>\n<\/li>\n<li>\n<p>100 \u043c\u0441 \u2014 \u044d\u0442\u043e \u043f\u0440\u0435\u0434\u0435\u043b, \u043f\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043b\u044e\u0434\u0438 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u044e\u0442 \u0447\u0443\u0432\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u043e\u043d\u0438 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u0438\u0440\u0443\u044e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438 \u0432 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435 (\u0442.\u0435. \u0438\u043c\u0435\u044e\u0442 \u00ab\u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u044b\u0439\u00bb \u043e\u043f\u044b\u0442), \u0438 \u0432\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442 \u0447\u0443\u0432\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u043e\u043d\u0438 \u043f\u0440\u0438\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0443 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0437\u0430 \u043d\u0438\u0445, \u0430 \u0437\u0430\u0442\u0435\u043c \u0436\u0434\u0443\u0442 \u043e\u0442\u0432\u0435\u0442\u0430. (<a href=\"https:\/\/web.dev\/rail\/#ux\"><u>\u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a<\/u><\/a>)<\/p>\n<\/li>\n<li>\n<p>\u041b\u0435\u0433\u043a\u043e \u0437\u0430\u043f\u043e\u043c\u043d\u0438\u0442\u044c, \u0447\u0442\u043e 100 \u043c\u0441 \u2014 \u044d\u0442\u043e 1\/10 \u0441\u0435\u043a\u0443\u043d\u0434\u044b. \u0423 \u043c\u0435\u043d\u044f \u043d\u0435\u0442 \u0442\u043e\u0439 \u0436\u0435 \u043b\u0435\u0433\u043a\u043e\u0439 \u043d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u043b\u043a\u0438 \u0434\u043b\u044f \u043d\u0430\u043d\u043e\u0441\u0435\u043a\u0443\u043d\u0434, \u044f \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u043c\u043d\u0438\u0442\u044c, \u0447\u0442\u043e 1 \u043c\u0441 = 1 000 000 \u043d\u0441, \u0430 \u0437\u0430\u0442\u0435\u043c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>SystemClock \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0432 JDK, \u043f\u043e\u044d\u0442\u043e\u043c\u0443, \u0435\u0441\u043b\u0438 \u0432\u044b \u0441\u0442\u0440\u0435\u043c\u0438\u0442\u0435\u0441\u044c \u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c\u044b\u0439 \u043a\u043e\u0434, \u0432\u0430\u043c \u043b\u0443\u0447\u0448\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>System.nanoTime()<\/code>.<\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<blockquote>\n<p>\u041c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043a\u0443\u0440\u0441\u0430<a href=\"https:\/\/otus.pw\/HEb9\/\"> \u00abAndroid Developer. Professional\u00bb.<\/a> \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u0444\u043e\u0440\u043c\u0430\u0442\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435, \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 \u043f\u0440\u0435\u043f\u043e\u0434\u0430\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u043a\u0443\u0440\u0441\u0430 \u2014 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0430\u0435\u043c \u043d\u0430 \u0434\u0435\u043d\u044c \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0445 \u0434\u0432\u0435\u0440\u0435\u0439 \u043e\u043d\u043b\u0430\u0439\u043d. \u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f<a href=\"https:\/\/otus.pw\/FOM4\/\"> \u0437\u0434\u0435\u0441\u044c.<\/a><\/p>\n<\/blockquote>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/593023\/\"> https:\/\/habr.com\/ru\/articles\/593023\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0412\u0447\u0435\u0440\u0430 \u0443 \u043c\u0435\u043d\u044f \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u0430 \u0438\u0434\u0435\u044f:<\/p>\n<div class=\"tm-iframe_temp\" data-src=\"https:\/\/embedd.srv.habr.com\/iframe\/61a8cd3cabb378f6450d1ad9\" data-style=\"\" id=\"61a8cd3cabb378f6450d1ad9\" width=\"\"><\/div>\n<p>\u041a\u043e\u043c\u0443-\u043d\u0438\u0431\u0443\u0434\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0430 \u0441\u0435\u0440\u0438\u044f \u0441\u0442\u0430\u0442\u0435\u0439, \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u043d\u0430\u044f \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0443 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 Android \u0432 \u044d\u043a\u0441\u043f\u043b\u0443\u0430\u0442\u0430\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0441\u0440\u0435\u0434\u0435?<\/p>\n<p>\u041d\u0435 \u0447\u0442\u043e-\u0442\u043e \u0442\u0438\u043f\u0430 &#171;\u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u043c Firebase Performance Monitoring&#187; (\u0447\u0442\u043e \u043c\u0435\u043d\u044f \u043d\u0435 \u043e\u0441\u043e\u0431\u043e \u0432\u043e\u043e\u0434\u0443\u0448\u0435\u0432\u043b\u044f\u0435\u0442), \u0430 \u0441\u043a\u043e\u0440\u0435\u0435 &#171;\u043a\u0430\u043a \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 Android&#187;.<\/p>\n<p>\u201c\u042f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442, \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u0435\u0440\u0432\u044b\u0439 onDraw \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438, \u043d\u043e \u043e\u043d \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430 API 25. \u041c\u043d\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u043b\u043e\u0441\u044c \u043a\u0430\u043a\u043e\u0435-\u0442\u043e \u0432\u0440\u0435\u043c\u044f, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c \u043f\u0440\u0438\u0447\u0438\u043d\u0443!\u201d<\/p>\n<p>\u041d\u0430 \u0447\u0442\u043e \u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b \u043f\u043e\u043b\u043e\u0436\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043e\u0442\u0437\u044b\u0432\u044b \u0438 \u0441\u0440\u0430\u0437\u0443 \u0440\u0435\u0448\u0438\u043b \u043d\u0430\u0447\u0430\u0442\u044c \u043f\u0438\u0441\u0430\u0442\u044c. \u042d\u0442\u0430 \u0441\u0435\u0440\u0438\u044f \u0441\u0442\u0430\u0442\u0435\u0439 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0441\u0432\u044f\u0449\u0435\u043d\u0430 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0443 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438 \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 Android \u0432 \u044d\u043a\u0441\u043f\u043b\u0443\u0430\u0442\u0430\u0446\u0438\u0438. \u041e\u043d\u0430 \u043e\u0437\u0430\u0433\u043b\u0430\u0432\u043b\u0435\u043d\u0430 Android Vitals \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u043d\u0430 \u0442\u0435\u0441\u043d\u043e \u0441\u0432\u044f\u0437\u0430\u043d\u0430 \u0441 <a href=\"https:\/\/developer.android.com\/topic\/performance\/vitals\"><u>Android vitals<\/u><\/a> \u043e\u0442 \u0441\u0430\u043c\u0438\u0445 Google:<\/p>\n<blockquote>\n<p>Android vitals \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u043d\u0438\u0446\u0438\u0430\u0442\u0438\u0432\u043e\u0439 Google, \u043d\u0430\u0446\u0435\u043b\u0435\u043d\u043d\u043e\u0439 \u043d\u0430 \u043f\u043e\u0432\u044b\u0448\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0438 \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u0438 Android-\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432. \u041a\u043e\u0433\u0434\u0430 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c, \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0432\u0448\u0438\u0439 \u0441\u0431\u043e\u0440 \u0434\u0430\u043d\u043d\u044b\u0445, \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0432\u0430\u0448\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0435\u0433\u043e Android-\u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0438\u0440\u0443\u0435\u0442 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0435\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u0431\u0430\u0442\u0430\u0440\u0435\u0438, \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0440\u0435\u043d\u0434\u0435\u0440\u0438\u043d\u0433\u0430 \u0438 \u043e\u0442\u043a\u0430\u0437\u0430\u0445 \u0432 \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f\u0445.<\/p>\n<\/blockquote>\n<p>\u0415\u0441\u043b\u0438 \u0443 \u0432\u0430\u0441 \u0435\u0441\u0442\u044c \u0432\u043e\u043f\u0440\u043e\u0441\u044b \u0438\u043b\u0438 \u0438\u0434\u0435\u0438 \u0434\u043b\u044f \u0431\u0443\u0434\u0443\u0449\u0438\u0445 \u0441\u0442\u0430\u0442\u0435\u0439, \u043d\u0435 \u0441\u0442\u0435\u0441\u043d\u044f\u0439\u0442\u0435\u0441\u044c \u043f\u0438\u0441\u0430\u0442\u044c \u043c\u043d\u0435 \u0432 <a href=\"https:\/\/twitter.com\/Piwai\"><u>Twitter<\/u><\/a>!<\/p>\n<p>\u0414\u043b\u044f \u0440\u0430\u0437\u043e\u0433\u0440\u0435\u0432\u0430 \u043d\u0430\u0447\u043d\u0443 \u0441 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0432\u043e\u043f\u0440\u043e\u0441\u0430:<\/p>\n<h2>\u0421\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438?<\/h2>\n<p>\u0427\u0442\u043e\u0431\u044b \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c, \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u0440\u044f\u0442\u044c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u044b, \u0442\u043e \u0435\u0441\u0442\u044c \u0440\u0430\u0437\u043d\u0438\u0446\u0443 \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0443\u043c\u044f \u043c\u043e\u043c\u0435\u043d\u0442\u0430\u043c\u0438 \u0432\u0440\u0435\u043c\u0435\u043d\u0438. JDK \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043d\u0430\u043c 2 \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f:<\/p>\n<pre><code class=\"java\">\/\/ \u041c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434\u044b \u0441 \u201c\u044d\u043f\u043e\u0445\u0438 Unix\u201d (00:00:00 UTC 1 \u044f\u043d\u0432\u0430\u0440\u044f 1970 \u0433.) System.currentTimeMillis() \/\/ \u041d\u0430\u043d\u043e\u0441\u0435\u043a\u0443\u043d\u0434\u044b \u0441 \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u0430\u0448\u0438\u043d\u044b. System.nanoTime() Android \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043a\u043b\u0430\u0441\u0441 SystemClock, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0435\u0449\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432: \/\/ (API 29) \u0422\u0430\u0439\u043c\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u0435\u0434\u0435\u0442 \u043e\u0442\u0441\u0447\u0435\u0442 \u0441 \u201c\u044d\u043f\u043e\u0445\u0438 Unix\u201d. \/\/ \u0421\u0438\u043d\u0445\u0440\u043e\u043d\u0438\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0440\u043e\u0432\u0430\u0439\u0434\u0435\u0440\u0430 \u043c\u0435\u0441\u0442\u043e\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430. SystemClock.currentGnssTimeClock() \/\/ \u041c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434\u044b \u0440\u0430\u0431\u043e\u0442\u044b \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u043f\u043e\u0442\u043e\u043a\u0435. SystemClock.currentThreadTimeMillis() \/\/ \u041c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434\u044b \u0441 \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0432\u0440\u0435\u043c\u044f, \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0435 \u0432 \u0441\u043f\u044f\u0449\u0435\u043c \u0440\u0435\u0436\u0438\u043c\u0435. SystemClock.elapsedRealtime() \/\/ \u041d\u0430\u043d\u043e\u0441\u0435\u043a\u0443\u043d\u0434\u044b \u0441 \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438, \u0432\u043a\u043b\u044e\u0447\u0430\u044f \u0432\u0440\u0435\u043c\u044f, \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0435 \u0432 \u0441\u043f\u044f\u0449\u0435\u043c \u0440\u0435\u0436\u0438\u043c\u0435. SystemClock.elapsedRealtimeNanos() \/\/ \u041c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434\u044b \u0441 \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438, \u043d\u0435 \u0441\u0447\u0438\u0442\u0430\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u043d\u043e\u0433\u043e \u0432 \u0433\u043b\u0443\u0431\u043e\u043a\u043e\u043c \u0441\u043d\u0435. SystemClock.uptimeMillis()<\/code><\/pre>\n<p>\u0427\u0442\u043e \u0438\u0437 \u044d\u0442\u043e\u0433\u043e \u043c\u043d\u043e\u0433\u043e\u043e\u0431\u0440\u0430\u0437\u0438\u044f \u0432\u044b\u0431\u0440\u0430\u0442\u044c? \u041e\u0442\u0432\u0435\u0442\u0438\u0442\u044c \u043d\u0430 \u044d\u0442\u043e\u0442 \u0432\u043e\u043f\u0440\u043e\u0441 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u043e\u0447\u044c <a href=\"https:\/\/developer.android.com\/reference\/android\/os\/SystemClock\"><u>javadoc<\/u><\/a> \u043f\u043e <code>SystemClock<\/code>:<\/p>\n<pre><code class=\"java\">\/\/ (API 29) Clock that starts at Unix epoch. \/\/ Synchronized using the device's location provider. SystemClock.currentGnssTimeClock() \/\/ Milliseconds running in the current thread. SystemClock.currentThreadTimeMillis() \/\/ Milliseconds since boot, including time spent in sleep. SystemClock.elapsedRealtime() \/\/ Nanoseconds since boot, including time spent in sleep. SystemClock.elapsedRealtimeNanos() \/\/ Milliseconds since boot, not counting time spent in deep sleep. SystemClock.uptimeMillis()<\/code><\/pre>\n<ul>\n<li>\n<p><a href=\"https:\/\/developer.android.com\/reference\/java\/lang\/System#currentTimeMillis()\"><u>System#currentTimeMillis<\/u><\/a> \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u0438\u043b\u0438 \u0442\u0435\u043b\u0435\u0444\u043e\u043d\u043d\u043e\u0439 \u0441\u0435\u0442\u044c\u044e, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432\u0440\u0435\u043c\u044f \u043c\u043e\u0436\u0435\u0442 \u043d\u0435\u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0443\u0435\u043c\u043e \u043f\u0440\u044b\u0433\u0430\u0442\u044c \u043d\u0430\u0437\u0430\u0434 \u0438\u043b\u0438 \u0432\u043f\u0435\u0440\u0435\u0434. \u041f\u0440\u0438 \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f\u0445 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u043e\u0432 \u0438\u043b\u0438 \u043f\u0440\u043e\u0448\u0435\u0434\u0448\u0435\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u043e\u0439 \u0442\u0430\u0439\u043c\u0435\u0440.<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p><a href=\"https:\/\/developer.android.com\/reference\/android\/os\/SystemClock#uptimeMillis()\"><u>SystemClock#uptimeMillis<\/u><\/a> \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f, \u043a\u043e\u0433\u0434\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442 \u0432 \u0440\u0435\u0436\u0438\u043c \u0433\u043b\u0443\u0431\u043e\u043a\u043e\u0433\u043e \u0441\u043d\u0430. \u041e\u043d \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043e\u0441\u043d\u043e\u0432\u043e\u0439 \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u0439 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u043e\u0432 \u043f\u0440\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 Thread#sleep(long), Object#wait(long) (\u044d\u0442\u043e \u043a\u0430\u0441\u0430\u0435\u0442\u0441\u044f \u0438 System#nanoTime). \u042d\u0442\u043e\u0442 \u0442\u0430\u0439\u043c\u0435\u0440 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u043e\u0432, \u043a\u043e\u0433\u0434\u0430 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b \u043d\u0435 \u0437\u0430\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0441\u043f\u044f\u0449\u0438\u0439 \u0440\u0435\u0436\u0438\u043c \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430.<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p><a href=\"https:\/\/developer.android.com\/reference\/android\/os\/SystemClock#elapsedRealtime()\"><u>SystemClock#elapsedRealtime<\/u><\/a> \u0438 <a href=\"https:\/\/developer.android.com\/reference\/android\/os\/SystemClock#elapsedRealtimeNanos()\"><u>SystemClock#elapsedRealtimeNanos<\/u><\/a> \u0437\u0430\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u044e\u0442 \u0438 \u0433\u043b\u0443\u0431\u043e\u043a\u0438\u0439 \u0441\u043e\u043d. \u042d\u0442\u0438 \u0442\u0430\u0439\u043c\u0435\u0440\u044b \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u043c\u043e\u0439 \u0443\u043d\u0438\u0432\u0435\u0440\u0441\u0430\u043b\u044c\u043d\u043e\u0439 \u043e\u0441\u043d\u043e\u0432\u043e\u0439 \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u043e\u0432.<\/p>\n<\/li>\n<\/ul>\n<p>\u0420\u0430\u0431\u043e\u0442\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0435 \u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 \u0433\u043b\u0443\u0431\u043e\u043a\u043e\u043c \u0441\u043d\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043d\u0430\u0448\u0438 \u043b\u0443\u0447\u0448\u0438\u0435 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u044b &#8212; <code>SystemClock.uptimeMillis()<\/code> \u0438 <code>System.nanoTime()<\/code>.<\/p>\n<h2>uptimeMillis() \u0438\u043b\u0438 nanoTime()?<\/h2>\n<p><code>System.nanoTime()<\/code> \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0447\u0435\u043d, \u0447\u0435\u043c <code>uptimeMillis()<\/code>, \u043d\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u043e \u044d\u0442\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u043c\u0438\u043a\u0440\u043e\u0431\u0435\u043d\u0447\u043c\u0430\u0440\u043a\u043e\u0432. \u041f\u0440\u0438 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432 \u044d\u043a\u0441\u043f\u043b\u0443\u0430\u0442\u0430\u0446\u0438\u0438 \u043d\u0430\u043c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0440\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0432 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445.<\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0441\u0440\u0430\u0432\u043d\u0438\u043c \u0438\u0445 \u0432\u043b\u0438\u044f\u043d\u0438\u0435 \u043d\u0430 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c. \u042f \u043a\u043b\u043e\u043d\u0438\u0440\u043e\u0432\u0430\u043b \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 <a href=\"https:\/\/github.com\/android\/performance-samples\"><u>Android Benchmark Samples<\/u><\/a> \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0442\u0435\u0441\u0442:<\/p>\n<pre><code class=\"java\">@LargeTest @RunWith(AndroidJUnit4::class) class TimingBenchmark {     @get:Rule     val benchmarkRule = BenchmarkRule()      @Test     fun nanoTime() {         benchmarkRule.measureRepeated {             System.nanoTime()         }     }      @Test     fun uptimeMillis() {         benchmarkRule.measureRepeated {             SystemClock.uptimeMillis()         }     } }<\/code><\/pre>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043d\u0430 Pixel 3 \u043f\u043e\u0434 Android 10:<\/p>\n<ul>\n<li>\n<p><code>System.nanoTime()<\/code> \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f: 208 \u043d\u0441<\/p>\n<\/li>\n<\/ul>\n<ul>\n<li>\n<p><code>SystemClock.uptimeMillis()<\/code> \u0441\u0440\u0435\u0434\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f: 116 \u043d\u0441<\/p>\n<\/li>\n<\/ul>\n<p><code>SystemClock.uptimeMillis()<\/code> \u043f\u043e\u0447\u0442\u0438 \u0432 \u0434\u0432\u0430 \u0440\u0430\u0437\u0430 \u0431\u044b\u0441\u0442\u0440\u0435\u0435! \u0425\u043e\u0442\u044f \u044d\u0442\u0430 \u0440\u0430\u0437\u043d\u0438\u0446\u0430 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u0430 \u0438\u043c\u0435\u0442\u044c \u0441\u043a\u043e\u043b\u044c\u043a\u043e-\u043d\u0438\u0431\u0443\u0434\u044c \u0437\u043d\u0430\u0447\u0438\u043c\u043e\u0433\u043e \u0432\u043b\u0438\u044f\u043d\u0438\u044f \u043d\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043c\u043e\u0436\u0435\u043c \u043b\u0438 \u043c\u044b \u043f\u043e\u043d\u044f\u0442\u044c, \u043f\u043e\u0447\u0435\u043c\u0443 \u043e\u043d \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435?<\/p>\n<h3>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f uptimeMillis()<\/h3>\n<p><code>SystemClock.uptimeMillis()<\/code> \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u0430 \u043a\u0430\u043a \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434, \u0430\u043d\u043d\u043e\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 <code>@CriticalNative<\/code>. <a href=\"https:\/\/cs.android.com\/android\/platform\/superproject\/+\/master:libcore\/dalvik\/src\/main\/java\/dalvik\/annotation\/optimization\/CriticalNative.java;l=99;drc=1a6015c8486695c938e1315403965e19997eaed8\"><u>CriticalNative<\/u><\/a> \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 \u0431\u044b\u0441\u0442\u0440\u044b\u0435 JNI-\u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u043b\u044f \u043c\u0435\u0442\u043e\u0434\u043e\u0432, \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0438\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432.<\/p>\n<pre><code class=\"java\">public final class SystemClock {     @CriticalNative     native public static long uptimeMillis(); }<\/code><\/pre>\n<p>(<a href=\"https:\/\/cs.android.com\/android\/platform\/superproject\/+\/master:frameworks\/base\/core\/java\/android\/os\/SystemClock.java;l=178;drc=bc3d8b9071d4f0b2903d6836770d974e70366290\"><u>\u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a<\/u><\/a>)<\/p>\n<p>\u041d\u0430\u0442\u0438\u0432\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 <code>SystemClock.cpp<\/code>:<\/p>\n<pre><code class=\"java\">int64_t uptimeMillis() {     int64_t when = systemTime(SYSTEM_TIME_MONOTONIC);     return (int64_t) nanoseconds_to_milliseconds(when); }<\/code><\/pre>\n<p>(<a href=\"https:\/\/cs.android.com\/android\/platform\/superproject\/+\/master:system\/core\/libutils\/SystemClock.cpp;l=40-44;drc=bab16584ce0525742b5370682c9132b2002ee110\"><u>\u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a<\/u><\/a>)<\/p>\n<p><code>systemTime()<\/code> \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d \u0432 <code>Timers.cpp<\/code>:<\/p>\n<pre><code class=\"java\">nsecs_t systemTime(int clock) {     static constexpr clockid_t clocks[] = {         CLOCK_REALTIME,         CLOCK_MONOTONIC,         CLOCK_PROCESS_CPUTIME_ID,         CLOCK_THREAD_CPUTIME_ID,         CLOCK_BOOTTIME     };     timespec t = {};     clock_gettime(clocks[clock], &amp;t);     return nsecs_t(t.tv_sec)*1000000000LL + t.tv_nsec; }<\/code><\/pre>\n<p>(<a href=\"https:\/\/cs.android.com\/android\/platform\/superproject\/+\/master:system\/core\/libutils\/Timers.cpp;l=35-44;drc=842e1cc17efca17f4a91b0bc678b39a1b1b43da4\"><u>\u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a<\/u><\/a>)<\/p>\n<h3>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f nanoTime()<\/h3>\n<p><code>System.nanoTime()<\/code> \u0442\u0430\u043a\u0436\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d \u043a\u0430\u043a \u043d\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434, \u0430\u043d\u043d\u043e\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 <code>@CriticalNative<\/code>.<\/p>\n<pre><code class=\"java\">public final class System {     @CriticalNative     public static native long nanoTime(); }<\/code><\/pre>\n<p>(<a href=\"https:\/\/cs.android.com\/android\/platform\/superproject\/+\/master:libcore\/ojluni\/src\/main\/java\/java\/lang\/System.java;l=345;drc=972664ff05e2531e8b37b572b3fb310077999868\"><u>\u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a<\/u><\/a>)<\/p>\n<p>\u041d\u0430\u0442\u0438\u0432\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 <code>System.c:<\/code><\/p>\n<pre><code class=\"java\">static jlong System_nanoTime() {   struct timespec now;   clock_gettime(CLOCK_MONOTONIC, &amp;now);   return now.tv_sec * 1000000000LL + now.tv_nsec; }<\/code><\/pre>\n<p>(<a href=\"https:\/\/cs.android.com\/android\/platform\/superproject\/+\/master:libcore\/ojluni\/src\/main\/native\/System.c;l=254-258;drc=c5f1494e3f0cdf6333bd0ba26bfac68da62e52d4\"><u>\u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a<\/u><\/a>)<\/p>\n<p>\u0414\u0432\u0435 \u044d\u0442\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436\u0438, \u043e\u043d\u0438 \u043e\u0431\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0442 <code>clock_gettime()<\/code>.<\/p>\n<p>\u041e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f, <code>@CriticalNative<\/code> \u0442\u043e\u043b\u044c\u043a\u043e <a href=\"https:\/\/cs.android.com\/android\/_\/android\/platform\/libcore\/+\/b3d1a7e9d8b92b5d3295a995c10836b769fa2600\"><u>\u043d\u0435\u0434\u0430\u0432\u043d\u043e \u0431\u044b\u043b\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0430<\/u><\/a> \u0432 <code>System.nanoTime()<\/code>, \u0447\u0442\u043e \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0435\u0442, \u043f\u043e\u0447\u0435\u043c\u0443 \u043e\u043d \u0431\u044b\u043b \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435!<\/p>\n<h2>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>\u041f\u0440\u0438 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u043d\u0438\u0438 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f:<\/p>\n<ul>\n<li>\n<p>\u0420\u0430\u0437\u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0432 \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0430 \u0441\u043b\u0443\u0447\u0430\u0435\u0432.<\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f \u0438\u0437\u043c\u0435\u0440\u0435\u043d\u0438\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b\u043e\u0432 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 <code>SystemClock.uptimeMillis()<\/code> \u0438\u043b\u0438 <code>System.nanoTime()<\/code>. \u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435 \u043d\u0430 \u0441\u0442\u0430\u0440\u044b\u0445 \u0432\u0435\u0440\u0441\u0438\u044f\u0445 Android, \u043d\u043e \u0441\u0435\u0439\u0447\u0430\u0441 \u044d\u0442\u043e \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u043e\u0441\u043e\u0431\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>\u042f \u043f\u0440\u0435\u0434\u043f\u043e\u0447\u0438\u0442\u0430\u044e <code>SystemClock.uptimeMillis()<\/code>, \u0442\u0430\u043a \u043a\u0430\u043a \u043c\u043d\u0435 \u043f\u0440\u043e\u0449\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434\u044b.<\/p>\n<\/li>\n<li>\n<p>100 \u043c\u0441 \u2014 \u044d\u0442\u043e \u043f\u0440\u0435\u0434\u0435\u043b, \u043f\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043b\u044e\u0434\u0438 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u044e\u0442 \u0447\u0443\u0432\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u043e\u043d\u0438 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u043c\u0430\u043d\u0438\u043f\u0443\u043b\u0438\u0440\u0443\u044e\u0442 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438 \u0432 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u043e\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435 (\u0442.\u0435. \u0438\u043c\u0435\u044e\u0442 \u00ab\u0438\u043d\u0442\u0443\u0438\u0442\u0438\u0432\u043d\u044b\u0439\u00bb \u043e\u043f\u044b\u0442), \u0438 \u0432\u043c\u0435\u0441\u0442\u043e \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0442 \u0447\u0443\u0432\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c, \u0447\u0442\u043e \u043e\u043d\u0438 \u043f\u0440\u0438\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u0443 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0437\u0430 \u043d\u0438\u0445, \u0430 \u0437\u0430\u0442\u0435\u043c \u0436\u0434\u0443\u0442 \u043e\u0442\u0432\u0435\u0442\u0430. (<a href=\"https:\/\/web.dev\/rail\/#ux\"><u>\u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a<\/u><\/a>)<\/p>\n<\/li>\n<li>\n<p>\u041b\u0435\u0433\u043a\u043e \u0437\u0430\u043f\u043e\u043c\u043d\u0438\u0442\u044c, \u0447\u0442\u043e 100 \u043c\u0441 \u2014 \u044d\u0442\u043e 1\/10 \u0441\u0435\u043a\u0443\u043d\u0434\u044b. \u0423 \u043c\u0435\u043d\u044f \u043d\u0435\u0442 \u0442\u043e\u0439 \u0436\u0435 \u043b\u0435\u0433\u043a\u043e\u0439 \u043d\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u043b\u043a\u0438 \u0434\u043b\u044f \u043d\u0430\u043d\u043e\u0441\u0435\u043a\u0443\u043d\u0434, \u044f \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u043c\u043d\u0438\u0442\u044c, \u0447\u0442\u043e 1 \u043c\u0441 = 1 000 000 \u043d\u0441, \u0430 \u0437\u0430\u0442\u0435\u043c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u044c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>SystemClock \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0432 JDK, \u043f\u043e\u044d\u0442\u043e\u043c\u0443, \u0435\u0441\u043b\u0438 \u0432\u044b \u0441\u0442\u0440\u0435\u043c\u0438\u0442\u0435\u0441\u044c \u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c\u044b\u0439 \u043a\u043e\u0434, \u0432\u0430\u043c \u043b\u0443\u0447\u0448\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>System.nanoTime()<\/code>.<\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<blockquote>\n<p>\u041c\u0430\u0442\u0435\u0440\u0438\u0430\u043b \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d \u0432 \u0440\u0430\u043c\u043a\u0430\u0445 \u043a\u0443\u0440\u0441\u0430<a href=\"https:\/\/otus.pw\/HEb9\/\"> \u00abAndroid Developer. Professional\u00bb.<\/a> \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0443\u0437\u043d\u0430\u0442\u044c \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e \u0444\u043e\u0440\u043c\u0430\u0442\u0435 \u043e\u0431\u0443\u0447\u0435\u043d\u0438\u044f \u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435, \u043f\u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 \u043f\u0440\u0435\u043f\u043e\u0434\u0430\u0432\u0430\u0442\u0435\u043b\u0435\u043c \u043a\u0443\u0440\u0441\u0430 \u2014 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0430\u0435\u043c \u043d\u0430 \u0434\u0435\u043d\u044c \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0445 \u0434\u0432\u0435\u0440\u0435\u0439 \u043e\u043d\u043b\u0430\u0439\u043d. \u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f<a href=\"https:\/\/otus.pw\/FOM4\/\"> \u0437\u0434\u0435\u0441\u044c.<\/a><\/p>\n<\/blockquote>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/593023\/\"> https:\/\/habr.com\/ru\/articles\/593023\/<\/a><br \/><\/br><\/br><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-413228","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/413228","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=413228"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/413228\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=413228"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=413228"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=413228"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}