diff options
author | Siva Velusamy <vsiva@google.com> | 2012-06-07 11:13:47 -0700 |
---|---|---|
committer | Siva Velusamy <vsiva@google.com> | 2012-06-07 11:13:47 -0700 |
commit | 74b8747ea4acfe74aec3f15a544862340f62587b (patch) | |
tree | b6dd9e75360cd7468bb5ce727a6a34ec6a81f227 /ddms/libs | |
parent | c28b7357bc2ac2ccca73be048a1aa970ef2d842a (diff) | |
download | sdk-74b8747ea4acfe74aec3f15a544862340f62587b.zip sdk-74b8747ea4acfe74aec3f15a544862340f62587b.tar.gz sdk-74b8747ea4acfe74aec3f15a544862340f62587b.tar.bz2 |
NetworkPanel: Update socket tag decoding
Change-Id: If2e89c894f5f11104e30d892bcae2b2daec17b08
Diffstat (limited to 'ddms/libs')
-rw-r--r-- | ddms/libs/ddmuilib/src/com/android/ddmuilib/net/NetworkPanel.java | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/ddms/libs/ddmuilib/src/com/android/ddmuilib/net/NetworkPanel.java b/ddms/libs/ddmuilib/src/com/android/ddmuilib/net/NetworkPanel.java index febd99c..ae28d07 100644 --- a/ddms/libs/ddmuilib/src/com/android/ddmuilib/net/NetworkPanel.java +++ b/ddms/libs/ddmuilib/src/com/android/ddmuilib/net/NetworkPanel.java @@ -751,7 +751,7 @@ public class NetworkPanel extends TablePanel { // entries together. final NetworkSnapshot.Entry entry = new NetworkSnapshot.Entry(); entry.iface = null; //cols[1]; - entry.uid = Integer.parseInt(cols[3]); + entry.uid = kernelToTag(cols[3]); entry.set = -1; //Integer.parseInt(cols[4]); entry.tag = (int) (Long.decode(cols[2]) >> 32); entry.rxBytes = Long.parseLong(cols[5]); @@ -762,6 +762,20 @@ public class NetworkPanel extends TablePanel { mSnapshot.combine(entry); } } + + /** + * Convert {@code /proc/} tag format to {@link Integer}. Assumes incoming + * format like {@code 0x7fffffff00000000}. + * Matches code in android.server.NetworkManagementSocketTagger + */ + public static int kernelToTag(String string) { + int length = string.length(); + if (length > 10) { + return Long.decode(string.substring(0, length - 8)).intValue(); + } else { + return 0; + } + } } /** |