Runnable在java中花费更多时间来完成

时间:2015-02-23 09:32:00

标签: java android multithreading

我有一个原生java android应用程序,我正在尝试使用Handler来监控数据使用情况:

private Handler mHandler = new Handler();

一个帖子:

mHandler.postDelayed(mRunnable, 1000);

为什么如果我监控数据使用情况,它总是花费比预期多10毫秒?

1000毫秒

02-23 04:29:00.829: D/DATA USAGE(1387): RECEIVED[0.454] Mb - SENT[0.154] Mb
02-23 04:29:01.839: D/DATA USAGE(1387): RECEIVED[0.472] Mb - SENT[0.155] Mb
02-23 04:29:02.849: D/DATA USAGE(1387): RECEIVED[0.473] Mb - SENT[0.157] Mb
02-23 04:29:03.859: D/DATA USAGE(1387): RECEIVED[0.477] Mb - SENT[0.160] Mb

5000毫秒:

02-23 04:17:17.669: D/DATA USAGE(1387): RECEIVED[0.193] Mb - SENT[0.065] Mb
02-23 04:17:22.679: D/DATA USAGE(1387): RECEIVED[0.194] Mb - SENT[0.065] Mb
02-23 04:17:27.689: D/DATA USAGE(1387): RECEIVED[0.194] Mb - SENT[0.065] Mb
02-23 04:17:32.699: D/DATA USAGE(1387): RECEIVED[0.194] Mb - SENT[0.065] Mb
02-23 04:17:37.709: D/DATA USAGE(1387): RECEIVED[0.194] Mb - SENT[0.065] Mb

0 个答案:

没有答案