Methods Summary |
---|
public static int | getThreadSocketStatsTag()
return threadSocketTags.get().statsTag;
|
public static void | install()
SocketTagger.set(new NetworkManagementSocketTagger());
|
public static int | kernelToTag(java.lang.String string)Convert {@code /proc/} tag format to {@link Integer}. Assumes incoming
format like {@code 0x7fffffff00000000}.
int length = string.length();
if (length > 10) {
return Long.decode(string.substring(0, length - 8)).intValue();
} else {
return 0;
}
|
private static native int | native_deleteTagData(int tag, int uid)
|
private static native int | native_setCounterSet(int uid, int counterSetNum)
|
private static native int | native_tagSocketFd(java.io.FileDescriptor fd, int tag, int uid)
|
private static native int | native_untagSocketFd(java.io.FileDescriptor fd)
|
public static void | resetKernelUidStats(int uid)
if (SystemProperties.getBoolean(PROP_QTAGUID_ENABLED, false)) {
int errno = native_deleteTagData(0, uid);
if (errno < 0) {
Slog.w(TAG, "problem clearing counters for uid " + uid + " : errno " + errno);
}
}
|
public static void | setKernelCounterSet(int uid, int counterSet)
if (SystemProperties.getBoolean(PROP_QTAGUID_ENABLED, false)) {
final int errno = native_setCounterSet(counterSet, uid);
if (errno < 0) {
Log.w(TAG, "setKernelCountSet(" + uid + ", " + counterSet + ") failed with errno "
+ errno);
}
}
|
public static void | setThreadSocketStatsTag(int tag)
threadSocketTags.get().statsTag = tag;
|
public static void | setThreadSocketStatsUid(int uid)
threadSocketTags.get().statsUid = uid;
|
public void | tag(java.io.FileDescriptor fd)
final SocketTags options = threadSocketTags.get();
if (LOGD) {
Log.d(TAG, "tagSocket(" + fd.getInt$() + ") with statsTag=0x"
+ Integer.toHexString(options.statsTag) + ", statsUid=" + options.statsUid);
}
// TODO: skip tagging when options would be no-op
tagSocketFd(fd, options.statsTag, options.statsUid);
|
private void | tagSocketFd(java.io.FileDescriptor fd, int tag, int uid)
if (tag == -1 && uid == -1) return;
if (SystemProperties.getBoolean(PROP_QTAGUID_ENABLED, false)) {
final int errno = native_tagSocketFd(fd, tag, uid);
if (errno < 0) {
Log.i(TAG, "tagSocketFd(" + fd.getInt$() + ", "
+ tag + ", " +
+ uid + ") failed with errno" + errno);
}
}
|
private void | unTagSocketFd(java.io.FileDescriptor fd)
final SocketTags options = threadSocketTags.get();
if (options.statsTag == -1 && options.statsUid == -1) return;
if (SystemProperties.getBoolean(PROP_QTAGUID_ENABLED, false)) {
final int errno = native_untagSocketFd(fd);
if (errno < 0) {
Log.w(TAG, "untagSocket(" + fd.getInt$() + ") failed with errno " + errno);
}
}
|
public void | untag(java.io.FileDescriptor fd)
if (LOGD) {
Log.i(TAG, "untagSocket(" + fd.getInt$() + ")");
}
unTagSocketFd(fd);
|