Skip to content

Commit 9047339

Browse files
author
Daniel Augustin
committed
minor readme adjustments
1 parent 22c2567 commit 9047339

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

adb/readme.md

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# The adp parsing part
2+
3+
To access the functions provided, a reader must first be created. When creating the reader, it is possible to specify where the `adb` application is located.
4+
5+
```
6+
reader := CreateReader("C:/Users/Test/AppData/Local/Android/Sdk/platform-tools/adb")
7+
```
8+
If `adb` is accessible via the `PATH` variable using `adb`, the path specification `adbpath` can be left empty:
9+
```
10+
reader := CreateReader("")
11+
```
12+
The 'Reader' interface now provides the following functions:
13+
1. Read and parse memory info by using `adb shell dumpsys meminfo`
14+
2. Read and parse running processes by using `adb shell ps`
15+
3. Get rough trend information
16+
17+
## Get memory information
18+
19+
This is the core functionality of the application. It first determines the process ID of the provided `packagename` with the help of the `adb shell pidof` call. Using the process ID and the `adb shell dumpsys meminfo` command, the memory information is retrieved and parsed. For common information groups, the essential information is converted to a key-value pair.
20+
21+
```
22+
Scan(packagename string) (map[string]int, string, error)
23+
```
24+
25+
## Get running processes
26+
27+
The endpoint uses the `adb shell ps -A -o NAME` command to determine all active processes. It ignores process information enclosed by `[` and `]`.
28+
29+
```
30+
Packages() []string
31+
```
32+
33+
## Get rough trend
34+
35+
For the evaluation of the storage behavior, an initial indication of the trend of storage usage is required. For performance reasons, no complete history of all measured values is kept. Instead, a low-pass filter is used to determine trends.
36+
37+
```
38+
Trend(key string, value int) (float64, float64, float64, float64)
39+
```
40+
41+
The method is given a `key` and a current `value`. For the provided key it calculates four trends:
42+
1. **result #1**: The change of the low-pass filter affected by the new `value` as follows: `filtervalue = filtervalue * 0.999 + value * 0.001` (0.1%)
43+
2. **result #2**: The change of the low-pass filter affected by the new `value` as follows: `filtervalue = filtervalue * 0.99 + value * 0.01` (1%)
44+
3. **result #3**: The change of the low-pass filter affected by the new `value` as follows: `filtervalue = filtervalue * 0.9 + value * 0.1` (10%)
45+
4. **result #4**: The change of the `value`, compared to the last measured one
46+
47+
This is not an exact trend calculation, especially since the trend information is lower the "slower" a low-pass filter reacts. Nevertheless, rough trends allow an overview of the memory behavior.

0 commit comments

Comments
 (0)