Snap for 6114771 from 5a99ba031e7ef53cab4703d4ed1a6d8d016e0b26 to rvc-release
Change-Id: I2f36f14113e964a1cf5daca2f0c8be270782d74a
This commit is contained in:
@@ -54,7 +54,7 @@ enum StatsType {
|
|||||||
TCP_TX_PACKETS = 5
|
TCP_TX_PACKETS = 5
|
||||||
};
|
};
|
||||||
|
|
||||||
static uint64_t getStatsType(struct Stats* stats, StatsType type) {
|
static uint64_t getStatsType(Stats* stats, StatsType type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case RX_BYTES:
|
case RX_BYTES:
|
||||||
return stats->rxBytes;
|
return stats->rxBytes;
|
||||||
@@ -73,7 +73,7 @@ static uint64_t getStatsType(struct Stats* stats, StatsType type) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int parseIfaceStats(const char* iface, struct Stats* stats) {
|
static int parseIfaceStats(const char* iface, Stats* stats) {
|
||||||
FILE *fp = fopen(QTAGUID_IFACE_STATS, "r");
|
FILE *fp = fopen(QTAGUID_IFACE_STATS, "r");
|
||||||
if (fp == NULL) {
|
if (fp == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
@@ -117,7 +117,7 @@ static int parseIfaceStats(const char* iface, struct Stats* stats) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int parseUidStats(const uint32_t uid, struct Stats* stats) {
|
static int parseUidStats(const uint32_t uid, Stats* stats) {
|
||||||
FILE *fp = fopen(QTAGUID_UID_STATS, "r");
|
FILE *fp = fopen(QTAGUID_UID_STATS, "r");
|
||||||
if (fp == NULL) {
|
if (fp == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
@@ -150,8 +150,7 @@ static int parseUidStats(const uint32_t uid, struct Stats* stats) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static jlong getTotalStat(JNIEnv* env, jclass clazz, jint type, jboolean useBpfStats) {
|
static jlong getTotalStat(JNIEnv* env, jclass clazz, jint type, jboolean useBpfStats) {
|
||||||
struct Stats stats;
|
Stats stats = {};
|
||||||
memset(&stats, 0, sizeof(Stats));
|
|
||||||
|
|
||||||
if (useBpfStats) {
|
if (useBpfStats) {
|
||||||
if (bpfGetIfaceStats(NULL, &stats) == 0) {
|
if (bpfGetIfaceStats(NULL, &stats) == 0) {
|
||||||
@@ -175,8 +174,7 @@ static jlong getIfaceStat(JNIEnv* env, jclass clazz, jstring iface, jint type,
|
|||||||
return UNKNOWN;
|
return UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct Stats stats;
|
Stats stats = {};
|
||||||
memset(&stats, 0, sizeof(Stats));
|
|
||||||
|
|
||||||
if (useBpfStats) {
|
if (useBpfStats) {
|
||||||
if (bpfGetIfaceStats(iface8.c_str(), &stats) == 0) {
|
if (bpfGetIfaceStats(iface8.c_str(), &stats) == 0) {
|
||||||
@@ -194,8 +192,7 @@ static jlong getIfaceStat(JNIEnv* env, jclass clazz, jstring iface, jint type,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static jlong getUidStat(JNIEnv* env, jclass clazz, jint uid, jint type, jboolean useBpfStats) {
|
static jlong getUidStat(JNIEnv* env, jclass clazz, jint uid, jint type, jboolean useBpfStats) {
|
||||||
struct Stats stats;
|
Stats stats = {};
|
||||||
memset(&stats, 0, sizeof(Stats));
|
|
||||||
|
|
||||||
if (useBpfStats) {
|
if (useBpfStats) {
|
||||||
if (bpfGetUidStats(uid, &stats) == 0) {
|
if (bpfGetUidStats(uid, &stats) == 0) {
|
||||||
|
|||||||
Reference in New Issue
Block a user