Skip to content

Files

Latest commit

 

History

History
---
title: "Experiment"
output:
  github_document:
    toc: yes
    toc_depth: 1
    dev: svg
---

# Description

# Results

```{r setup, message = FALSE}

library(tidyverse)
theme_set(theme_bw())
library(knitr)
library(forcats)
library(data.table)
library(cowplot)
library(gghighlight)
library(zoo)
library(RColorBrewer)

saveplot <- function(filename, ...) {
  ggsave2(filename, ...)
  knitr::plot_crop(filename)
}
```

## Frame Rate

```{r frame_rate}
fps <- system('grep -Po "(?<=FPS=)[0-9]+" logcat_VrApi.log', intern = TRUE)
data <- tibble(fps) %>% mutate(fps = as.numeric(fps)) %>% mutate(ts = 0:(n()-1)) %>% select(ts, everything())
data %>%
ggplot(aes(x = ts, y=fps)) +
geom_line() +
ylim(0, NA) +
theme_half_open() + background_grid()
```
## Power Draw

### CPU Frequency

```{r battery_headset}
if (file.exists("logcat_VrApi.log")) {
cpu_freq <- system('grep -Po "(?<=CPU4/GPU=)[0-9]/[0-9],[0-9]+/[0-9]+(?=MHz,OC)" logcat_VrApi.log | cut -d, -f 2 | cut -d/ -f 1', intern = TRUE)
data <- tibble(cpu_freq) %>% mutate(cpu_freq = as.numeric(cpu_freq)) %>% mutate(ts = 0:(n()-1)) %>% select(ts, everything())
data %>%
ggplot(aes(x = ts, y=cpu_freq)) +
geom_line() +
ylim(0, NA) +
labs(y = "MHz", x = "time [s]") +
theme_half_open() + background_grid()
}
```
### GPU Frequency

```{r battery_headset}
if (file.exists("logcat_VrApi.log")) {
gpu_freq <- system('grep -Po "(?<=CPU4/GPU=)[0-9]/[0-9],[0-9]+/[0-9]+(?=MHz,OC)" logcat_VrApi.log | cut -d, -f 2 | cut -d/ -f 2', intern = TRUE)
data <- tibble(gpu_freq) %>% mutate(gpu_freq = as.numeric(gpu_freq)) %>% mutate(ts = 0:(n()-1)) %>% select(ts, everything())
data %>%
ggplot(aes(x = ts, y=gpu_freq)) +
geom_line() +
ylim(0, NA) +
labs(y = "MHz", x = "time [s]") +
theme_half_open() + background_grid()
}
```
### CPU Level

```{r battery_headset}
if (file.exists("logcat_VrApi.log")) {
cpu_freq <- system('grep -Po "(?<=CPU4/GPU=)[0-9]/[0-9],[0-9]+/[0-9]+(?=MHz,OC)" logcat_VrApi.log | cut -d, -f 1 | cut -d/ -f 1', intern = TRUE)
data <- tibble(cpu_freq) %>% mutate(cpu_freq = as.numeric(cpu_freq)) %>% mutate(ts = 0:(n()-1)) %>% select(ts, everything())
data %>%
ggplot(aes(x = ts, y=cpu_freq)) +
geom_line() +
ylim(0, NA) +
labs(y = "Level", x = "time [s]") +
theme_half_open() + background_grid()
}
```

### GPU Level

```{r battery_headset}
if (file.exists("logcat_VrApi.log")) {
gpu_freq <- system('grep -Po "(?<=CPU4/GPU=)[0-9]/[0-9],[0-9]+/[0-9]+(?=MHz,OC)" logcat_VrApi.log | cut -d, -f 1 | cut -d/ -f 2', intern = TRUE)
data <- tibble(gpu_freq) %>% mutate(gpu_freq = as.numeric(gpu_freq)) %>% mutate(ts = 0:(n()-1)) %>% select(ts, everything())
data %>%
ggplot(aes(x = ts, y=gpu_freq)) +
geom_line() +
ylim(0, NA) +
labs(y = "Level", x = "time [s]") +
theme_half_open() + background_grid()
}
```

## Battery Levels

### Headset

```{r battery_headset}
if (file.exists("battery.log")) {
battery <- system('grep -Po "(?<=level: )[0-9]+" battery.log', intern = TRUE)
data <- tibble(battery) %>% mutate(battery = as.numeric(battery)) %>% mutate(ts = 0:(n()-1)) %>% select(ts, everything())
data %>%
ggplot(aes(x = ts, y=battery)) +
geom_line() +
ylim(0, NA) +
theme_half_open() + background_grid()
}
```

### Controllers

```{r battery_controllers}
if (file.exists("OVRRemoteService.log")) {
battery <- system("grep -Po '(?<=Type:)\\s+(Left|Right),.+Battery:\\s+[0-9]+(?=%)' OVRRemoteService.log | tr -s ' ' | sed -e \'s/^[[:space:]]*//\' -e \'s/\\n[[:space:]]*//\' | cut -d' ' -f 1,7", intern=TRUE)
data <- tibble(battery) %>% separate(battery, c("hand", "level"), convert = TRUE) %>% group_by(hand) %>% mutate(ts = 0:(n()-1)) %>% select(ts, everything())
data %>%
ggplot(aes(x=ts, y=level, color=hand)) +
geom_line() +
ylim(0, NA) +
theme_half_open() + background_grid()
}
```

## CPU Usage

```{r cpu_usage}
cpu_util <- system('grep -Po "(?<=CPU%=)[0-9]+.[0-9]+" logcat_VrApi.log', intern = TRUE)
data <- tibble(cpu_util) %>% mutate(cpu_util = 100 * as.numeric(cpu_util)) %>% mutate(ts = 0:(n()-1)) %>% select(ts, everything())
data %>%
ggplot(aes(x = ts, y=cpu_util)) +
geom_line() +
ylim(0, NA) +
theme_half_open() + background_grid()
```

## GPU Usage

```{r gpu_usage}
gpu_util <- system('grep -Po "(?<=GPU%=)[0-9]+.[0-9]+" logcat_VrApi.log', intern = TRUE)
data <- tibble(gpu_util) %>% mutate(gpu_util = 100 * as.numeric(gpu_util)) %>% mutate(ts = 0:(n()-1)) %>% select(ts, everything())
data %>%
ggplot(aes(x = ts, y=gpu_util)) +
geom_line() +
ylim(0, NA) +
theme_half_open() + background_grid()
```

## Memory Usage

```{r memory_usage}
mem_usage <- system('grep -Po "(?<=Free=)[0-9]+" logcat_VrApi.log', intern = TRUE)
data <- tibble(mem_usage) %>% mutate(mem_usage = 12288 - as.numeric(mem_usage)) %>% mutate(ts = 0:(n()-1)) %>% select(ts, everything())
data %>%
ggplot(aes(x = ts, y=mem_usage)) +
geom_line() +
ylim(0, NA) +
theme_half_open() + background_grid()
```

## Temperature

```{r temperature}
temp <- system('grep -Po "(?<=Temp=)[0-9]+" logcat_VrApi.log', intern = TRUE)
data <- tibble(temp) %>% mutate(temp = as.numeric(temp)) %>% mutate(ts = 0:(n()-1)) %>% select(ts, everything())
data %>%
ggplot(aes(x = ts, y=temp)) +
geom_line() +
ylim(0, NA) +
theme_half_open() + background_grid()
```

## Network Usage

```{r parse_network_data}
network <- system('grep -P "\\s+wlan0\\W" net_dev.log | tr -s " " | sed -e \'s/^[[:space:]]*//\' -e \'s/\\n[[:space:]]*//\'', intern = TRUE)
data <- tibble(network) %>% separate(network, c("interface", "bytes_rx", "packets_rx", "errs_rx", "drop_rx", "fifo_rx", "frame_rx", "compressed_rx", "multicast_rx", "bytes_tx", "packets_tx", "errs_tx", "drop_tx", "fifo_tx", "colls_tx", "carrier_tx", "compressed_tx"), sep = " ", convert = TRUE) %>% mutate(ts = 0:(n()-1))
```

### Bytes Recv

<!-- Inter-|   Receive                                                |  Transmit -->
<!-- face |bytes    packets errs drop fifo frame compressed multicast|bytes    packets errs drop fifo colls carrier compressed -->
```{r bytes_recv}
data %>%
mutate(bytes_rx = (bytes_rx - lag(bytes_rx)) / 1000) %>%
ggplot(aes(x = ts, y=bytes_rx)) +
geom_line() +
ylab("KB/s") +
ylim(0, NA) +
theme_half_open() + background_grid()
```

### Bytes Sent

```{r bytes_sent}
data %>%
mutate(bytes_tx = (bytes_tx - lag(bytes_tx)) / 1000) %>%
ggplot(aes(x = ts, y=bytes_tx)) +
geom_line() +
ylab("KB/s") +
ylim(0, NA) +
theme_half_open() + background_grid()
```

### Packets Recv

```{r packets_recv}
data %>%
mutate(packets_rx = packets_rx - lag(packets_rx)) %>%
ggplot(aes(x = ts, y=packets_rx)) +
geom_line() +
ylim(0, NA) +
theme_half_open() + background_grid()
```

### Packets Sent

```{r packets_sent}
data %>%
mutate(packets_tx = packets_tx - lag(packets_tx)) %>%
ggplot(aes(x = ts, y=packets_tx)) +
geom_line() +
ylim(0, NA) +
theme_half_open() + background_grid()
```