Merge "Wakeup packet events: addressing a few comments"

This commit is contained in:
Hugo Benichi
2017-09-19 07:12:03 +00:00
committed by Gerrit Code Review
7 changed files with 14 additions and 14 deletions

View File

@@ -35,7 +35,7 @@ public class WakeupStats {
public long systemWakeups = 0; public long systemWakeups = 0;
public long nonApplicationWakeups = 0; public long nonApplicationWakeups = 0;
public long applicationWakeups = 0; public long applicationWakeups = 0;
public long unroutedWakeups = 0; public long noUidWakeups = 0;
public long durationSec = 0; public long durationSec = 0;
public WakeupStats(String iface) { public WakeupStats(String iface) {
@@ -58,7 +58,7 @@ public class WakeupStats {
systemWakeups++; systemWakeups++;
break; break;
case NO_UID: case NO_UID:
unroutedWakeups++; noUidWakeups++;
break; break;
default: default:
if (ev.uid >= Process.FIRST_APPLICATION_UID) { if (ev.uid >= Process.FIRST_APPLICATION_UID) {
@@ -80,7 +80,7 @@ public class WakeupStats {
.append(", system: ").append(systemWakeups) .append(", system: ").append(systemWakeups)
.append(", apps: ").append(applicationWakeups) .append(", apps: ").append(applicationWakeups)
.append(", non-apps: ").append(nonApplicationWakeups) .append(", non-apps: ").append(nonApplicationWakeups)
.append(", unrouted: ").append(unroutedWakeups) .append(", no uid: ").append(noUidWakeups)
.append(", ").append(durationSec).append("s)") .append(", ").append(durationSec).append("s)")
.toString(); .toString();
} }

View File

@@ -501,8 +501,8 @@ message WakeupStats {
// between [1001, 9999]. See android.os.Process for possible uids. // between [1001, 9999]. See android.os.Process for possible uids.
optional int64 non_application_wakeups = 6; optional int64 non_application_wakeups = 6;
// The total number of wakeup packets with no associated sockets. // The total number of wakeup packets with no associated socket or uid.
optional int64 unrouted_wakeups = 7; optional int64 no_uid_wakeups = 7;
} }
// Represents one of the IP connectivity event defined in this file. // Represents one of the IP connectivity event defined in this file.

View File

@@ -126,7 +126,7 @@ final public class IpConnectivityEventBuilder {
wakeupStats.systemWakeups = in.systemWakeups; wakeupStats.systemWakeups = in.systemWakeups;
wakeupStats.nonApplicationWakeups = in.nonApplicationWakeups; wakeupStats.nonApplicationWakeups = in.nonApplicationWakeups;
wakeupStats.applicationWakeups = in.applicationWakeups; wakeupStats.applicationWakeups = in.applicationWakeups;
wakeupStats.unroutedWakeups = in.unroutedWakeups; wakeupStats.noUidWakeups = in.noUidWakeups;
final IpConnectivityEvent out = buildEvent(0, 0, in.iface); final IpConnectivityEvent out = buildEvent(0, 0, in.iface);
out.setWakeupStats(wakeupStats); out.setWakeupStats(wakeupStats);
return out; return out;

View File

@@ -170,11 +170,11 @@ public class NetdEventListenerService extends INetdEventListener.Stub {
timestampMs = System.currentTimeMillis(); timestampMs = System.currentTimeMillis();
} }
addWakupEvent(iface, timestampMs, uid); addWakeupEvent(iface, timestampMs, uid);
} }
@GuardedBy("this") @GuardedBy("this")
private void addWakupEvent(String iface, long timestampMs, int uid) { private void addWakeupEvent(String iface, long timestampMs, int uid) {
int index = wakeupEventIndex(mWakeupEventCursor); int index = wakeupEventIndex(mWakeupEventCursor);
mWakeupEventCursor++; mWakeupEventCursor++;
WakeupEvent event = new WakeupEvent(); WakeupEvent event = new WakeupEvent();

View File

@@ -512,7 +512,7 @@ public class IpConnectivityEventBuilderTest {
stats.nonApplicationWakeups = 1; stats.nonApplicationWakeups = 1;
stats.rootWakeups = 2; stats.rootWakeups = 2;
stats.systemWakeups = 3; stats.systemWakeups = 3;
stats.unroutedWakeups = 3; stats.noUidWakeups = 3;
IpConnectivityEvent got = IpConnectivityEventBuilder.toProto(stats); IpConnectivityEvent got = IpConnectivityEventBuilder.toProto(stats);
String want = String.join("\n", String want = String.join("\n",
@@ -526,11 +526,11 @@ public class IpConnectivityEventBuilderTest {
" wakeup_stats <", " wakeup_stats <",
" application_wakeups: 5", " application_wakeups: 5",
" duration_sec: 0", " duration_sec: 0",
" no_uid_wakeups: 3",
" non_application_wakeups: 1", " non_application_wakeups: 1",
" root_wakeups: 2", " root_wakeups: 2",
" system_wakeups: 3", " system_wakeups: 3",
" total_wakeups: 14", " total_wakeups: 14",
" unrouted_wakeups: 3",
" >", " >",
">", ">",
"version: 2\n"); "version: 2\n");

View File

@@ -423,11 +423,11 @@ public class IpConnectivityMetricsTest {
" wakeup_stats <", " wakeup_stats <",
" application_wakeups: 2", " application_wakeups: 2",
" duration_sec: 0", " duration_sec: 0",
" no_uid_wakeups: 0",
" non_application_wakeups: 0", " non_application_wakeups: 0",
" root_wakeups: 0", " root_wakeups: 0",
" system_wakeups: 1", " system_wakeups: 1",
" total_wakeups: 3", " total_wakeups: 3",
" unrouted_wakeups: 0",
" >", " >",
">", ">",
"events <", "events <",
@@ -439,11 +439,11 @@ public class IpConnectivityMetricsTest {
" wakeup_stats <", " wakeup_stats <",
" application_wakeups: 1", " application_wakeups: 1",
" duration_sec: 0", " duration_sec: 0",
" no_uid_wakeups: 1",
" non_application_wakeups: 0", " non_application_wakeups: 0",
" root_wakeups: 0", " root_wakeups: 0",
" system_wakeups: 2", " system_wakeups: 2",
" total_wakeups: 4", " total_wakeups: 4",
" unrouted_wakeups: 1",
" >", " >",
">", ">",
"version: 2\n"); "version: 2\n");

View File

@@ -163,11 +163,11 @@ public class NetdEventListenerServiceTest {
" wakeup_stats <", " wakeup_stats <",
" application_wakeups: 3", " application_wakeups: 3",
" duration_sec: 0", " duration_sec: 0",
" no_uid_wakeups: 0",
" non_application_wakeups: 0", " non_application_wakeups: 0",
" root_wakeups: 0", " root_wakeups: 0",
" system_wakeups: 2", " system_wakeups: 2",
" total_wakeups: 5", " total_wakeups: 5",
" unrouted_wakeups: 0",
" >", " >",
">", ">",
"events <", "events <",
@@ -179,11 +179,11 @@ public class NetdEventListenerServiceTest {
" wakeup_stats <", " wakeup_stats <",
" application_wakeups: 2", " application_wakeups: 2",
" duration_sec: 0", " duration_sec: 0",
" no_uid_wakeups: 2",
" non_application_wakeups: 1", " non_application_wakeups: 1",
" root_wakeups: 2", " root_wakeups: 2",
" system_wakeups: 3", " system_wakeups: 3",
" total_wakeups: 10", " total_wakeups: 10",
" unrouted_wakeups: 2",
" >", " >",
">", ">",
"version: 2\n"); "version: 2\n");