2020-05-01 18:47:41 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
# Sandbox does not provide CAP_NET_ADMIN capability but does have ProcFS mounted at /proc
|
|
|
|
# This ensures that OS metrics can be collected
|
|
|
|
|
|
|
|
|
|
|
|
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
2020-12-28 11:46:53 +00:00
|
|
|
# shellcheck source=../shell_config.sh
|
2020-08-01 00:51:12 +00:00
|
|
|
. "$CURDIR"/../shell_config.sh
|
2020-05-01 18:47:41 +00:00
|
|
|
|
2022-04-25 05:19:55 +00:00
|
|
|
# NOTE: netlink taskstruct interface uses rounding to 1KB [1], so we cannot use ${BASH_SOURCE[0]}
|
|
|
|
#
|
|
|
|
# [1]: https://elixir.bootlin.com/linux/v5.18-rc4/source/kernel/tsacct.c#L101
|
|
|
|
tmp_path=$(mktemp "$CURDIR/01268_procfs_metrics.XXXXXX")
|
|
|
|
trap 'rm -f $tmp_path' EXIT
|
|
|
|
truncate -s1025 "$tmp_path"
|
|
|
|
|
2024-07-10 06:04:46 +00:00
|
|
|
$CLICKHOUSE_LOCAL --profile-events-delay-ms=-1 --print-profile-events --storage_file_read_method=pread -q "SELECT * FROM file('$tmp_path', 'LineAsString') FORMAT Null" |& grep -m1 -F -o -e OSReadChars
|
2022-04-25 05:19:55 +00:00
|
|
|
# NOTE: that OSCPUVirtualTimeMicroseconds is in microseconds, so 1e6 is not enough.
|
2022-05-07 20:14:58 +00:00
|
|
|
$CLICKHOUSE_LOCAL --profile-events-delay-ms=-1 --print-profile-events -q "SELECT * FROM numbers(1e8) FORMAT Null" |& grep -m1 -F -o -e OSCPUVirtualTimeMicroseconds
|
2022-04-25 05:19:55 +00:00
|
|
|
exit 0
|