diff options
author | alexv-smirnov <alex@ydb.tech> | 2023-05-24 20:44:52 +0300 |
---|---|---|
committer | alexv-smirnov <alex@ydb.tech> | 2023-05-24 20:44:52 +0300 |
commit | 12a3fbb619e9f5c885ecb3340e06b48b008d3814 (patch) | |
tree | 10c2654623d002d0f31835c1a3124df9d0789dd8 | |
parent | f14549c83decddd1c8634ce32c8616ebb654c5a3 (diff) | |
download | ydb-12a3fbb619e9f5c885ecb3340e06b48b008d3814.tar.gz |
Examples in lwtrace
-rw-r--r-- | library/cpp/lwtrace/example1/example_query.tr | 10 | ||||
-rwxr-xr-x | library/cpp/lwtrace/example1/start_with_query.sh | 3 | ||||
-rw-r--r-- | library/cpp/lwtrace/example2/destructive.tr | 36 | ||||
-rw-r--r-- | library/cpp/lwtrace/example2/empty.tr | 0 | ||||
-rw-r--r-- | library/cpp/lwtrace/example2/example_query.tr | 79 | ||||
-rw-r--r-- | library/cpp/lwtrace/example3/example_query.tr | 13 | ||||
-rwxr-xr-x | library/cpp/lwtrace/example3/start_with_query.sh | 6 | ||||
-rw-r--r-- | library/cpp/lwtrace/example4/example_query.tr | 10 | ||||
-rwxr-xr-x | library/cpp/lwtrace/example4/start_with_query.sh | 3 | ||||
-rw-r--r-- | library/cpp/lwtrace/example5/example_query.tr | 9 | ||||
-rwxr-xr-x | library/cpp/lwtrace/example5/start_with_query.sh | 3 |
11 files changed, 172 insertions, 0 deletions
diff --git a/library/cpp/lwtrace/example1/example_query.tr b/library/cpp/lwtrace/example1/example_query.tr new file mode 100644 index 0000000000..a06e2a922d --- /dev/null +++ b/library/cpp/lwtrace/example1/example_query.tr @@ -0,0 +1,10 @@ +Blocks { + ProbeDesc { + Name: "IterationProbe" + Provider: "LWTRACE_EXAMPLE_PROVIDER" + } + Action { + PrintToStderrAction { } + } +} + diff --git a/library/cpp/lwtrace/example1/start_with_query.sh b/library/cpp/lwtrace/example1/start_with_query.sh new file mode 100755 index 0000000000..2b456d7be7 --- /dev/null +++ b/library/cpp/lwtrace/example1/start_with_query.sh @@ -0,0 +1,3 @@ +#!/bin/bash +export LWTRACE="example_query.tr" +./lwtrace-example1 diff --git a/library/cpp/lwtrace/example2/destructive.tr b/library/cpp/lwtrace/example2/destructive.tr new file mode 100644 index 0000000000..ad955db018 --- /dev/null +++ b/library/cpp/lwtrace/example2/destructive.tr @@ -0,0 +1,36 @@ +Blocks { + ProbeDesc { Name: "IterationProbe" Provider: "LWTRACE_EXAMPLE_PROVIDER" } + Action { + SleepAction { + NanoSeconds: 100000000 + } + } +} + +Blocks { + ProbeDesc { Name: "AfterInputProbe" Provider: "LWTRACE_EXAMPLE_PROVIDER" } + Action { + StatementAction { + Type: ST_MOD + Argument { Variable: "nMod2" } + Argument { Param: "n" } + Argument { Value: "2" } + } + } +} +Blocks { + ProbeDesc { Name: "AfterInputProbe" Provider: "LWTRACE_EXAMPLE_PROVIDER" } + Predicate { + Operators { + Type: OT_EQ + Argument { Variable: "nMod2" } + Argument { Value: "0" } + } + } + Action { + PrintToStderrAction { } + } + Action { + KillAction { } + } +} diff --git a/library/cpp/lwtrace/example2/empty.tr b/library/cpp/lwtrace/example2/empty.tr new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/library/cpp/lwtrace/example2/empty.tr diff --git a/library/cpp/lwtrace/example2/example_query.tr b/library/cpp/lwtrace/example2/example_query.tr new file mode 100644 index 0000000000..31b5465860 --- /dev/null +++ b/library/cpp/lwtrace/example2/example_query.tr @@ -0,0 +1,79 @@ +Blocks { + ProbeDesc { + Name: "StartupProbe" + Provider: "LWTRACE_EXAMPLE_PROVIDER" + } + Action { + PrintToStderrAction { } + } +} + +Blocks { + ProbeDesc { Name: "IterationProbe" Provider: "LWTRACE_EXAMPLE_PROVIDER" } + Action { + LogAction { + LogTimestamp: true + MaxRecords: 2 + } + } +} + +Blocks { + ProbeDesc { Name: "ByrefDurationProbe" Provider: "LWTRACE_EXAMPLE_PROVIDER" } + Action { + LogAction { + LogTimestamp: true + MaxRecords: 1 + } + } + Action { + PrintToStderrAction { } + } +} + +Blocks { + ProbeDesc { Name: "DurationProbe" Provider: "LWTRACE_EXAMPLE_PROVIDER" } + Action { + LogAction { + LogTimestamp: true + MaxRecords: 1 + } + } + Action { + PrintToStderrAction { } + } +} + +Blocks { + ProbeDesc { Name: "ResultProbe" Provider: "LWTRACE_EXAMPLE_PROVIDER" } + Action { + PrintToStderrAction { } + } + Action { + LogAction { LogTimestamp: true } + } +} + + +Blocks { + ProbeDesc { Name: "AfterInputProbe" Provider: "LWTRACE_EXAMPLE_PROVIDER" } + Action { + StatementAction { + Type: ST_MOD + Argument { Variable: "nMod2" } + Argument { Param: "n" } + Argument { Value: "2" } + } + } +} +Blocks { + ProbeDesc { Name: "AfterInputProbe" Provider: "LWTRACE_EXAMPLE_PROVIDER" } + Predicate { + Operators { + Type: OT_EQ + Argument { Variable: "nMod2" } + Argument { Value: "0" } + } + } + Action { LogAction { } } +} diff --git a/library/cpp/lwtrace/example3/example_query.tr b/library/cpp/lwtrace/example3/example_query.tr new file mode 100644 index 0000000000..1f841b0932 --- /dev/null +++ b/library/cpp/lwtrace/example3/example_query.tr @@ -0,0 +1,13 @@ +Blocks { + ProbeDesc { + Name: "IterationProbe" + Provider: "LWTRACE_EXAMPLE_PROVIDER" + } + Action { + CustomAction { + Name: "MyAction" + Opts: "/dev/stdout" + } + } +} + diff --git a/library/cpp/lwtrace/example3/start_with_query.sh b/library/cpp/lwtrace/example3/start_with_query.sh new file mode 100755 index 0000000000..5cd221856f --- /dev/null +++ b/library/cpp/lwtrace/example3/start_with_query.sh @@ -0,0 +1,6 @@ +#!/bin/bash +echo "Executing program with following trace query:" +cat example_query.tr +echo -n "Press any key to start program" +read +LWTRACE="example_query.tr" ./lwtrace-example3 diff --git a/library/cpp/lwtrace/example4/example_query.tr b/library/cpp/lwtrace/example4/example_query.tr new file mode 100644 index 0000000000..46cd25ce91 --- /dev/null +++ b/library/cpp/lwtrace/example4/example_query.tr @@ -0,0 +1,10 @@ +Blocks { + ProbeDesc { + Name: "BackTrack" + Provider: "LWTRACE_EXAMPLE_PROVIDER" + } + Action { + PrintToStderrAction { } + } +} + diff --git a/library/cpp/lwtrace/example4/start_with_query.sh b/library/cpp/lwtrace/example4/start_with_query.sh new file mode 100755 index 0000000000..5bc195c1ae --- /dev/null +++ b/library/cpp/lwtrace/example4/start_with_query.sh @@ -0,0 +1,3 @@ +#!/bin/bash +export LWTRACE="example_query.tr" +./lwtrace-example4 diff --git a/library/cpp/lwtrace/example5/example_query.tr b/library/cpp/lwtrace/example5/example_query.tr new file mode 100644 index 0000000000..90887d4ddf --- /dev/null +++ b/library/cpp/lwtrace/example5/example_query.tr @@ -0,0 +1,9 @@ +Blocks { + ProbeDesc { + Group: "LWTRACE_EXAMPLE_PROVIDER" + } + Action { + PrintToStderrAction { } + } +} + diff --git a/library/cpp/lwtrace/example5/start_with_query.sh b/library/cpp/lwtrace/example5/start_with_query.sh new file mode 100755 index 0000000000..4df5e4e47c --- /dev/null +++ b/library/cpp/lwtrace/example5/start_with_query.sh @@ -0,0 +1,3 @@ +#!/bin/bash +export LWTRACE="example_query.tr" +./lwtrace-example5 |