summaryrefslogtreecommitdiff
path: root/scripts/logger.sh
blob: 8412b0ba9a080f10e164d015b717a6dbac199f44 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/sh

now() {
	awk '/^now/ {time=$3; printf("[%u.%06u]", time / 1000000000, (time % 1000000000) / 1000) ; exit}' /proc/timer_list
}

label=${1:+ [$1]}

TRACE_MARKER=/sys/kernel/debug/tracing/trace_marker
if [ -e $TRACE_MARKER ]; then
	extra_log_files=$TRACE_MARKER
fi

while read line ; do
	newline="$(now)$label $line"

	echo "$newline"

	for f in $extra_log_files; do
		echo "$newline" >> $f;
	done;
done