diff options
| author | Cthulhu <[email protected]> | 2022-02-10 16:47:44 +0300 |
|---|---|---|
| committer | Daniil Cherednik <[email protected]> | 2022-02-10 16:47:44 +0300 |
| commit | 6aced6c854653b75aab9808d5995be5fc4d9fa53 (patch) | |
| tree | c0748b5dcbade83af788c0abfa89c0383d6b779c /library/cpp/lwtrace/example3 | |
| parent | bcb3e9d0eb2a8188a6a9fe0907a8949ce4881a4e (diff) | |
Restoring authorship annotation for Cthulhu <[email protected]>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/lwtrace/example3')
| -rw-r--r-- | library/cpp/lwtrace/example3/example_query.tr | 18 | ||||
| -rw-r--r-- | library/cpp/lwtrace/example3/lwtrace_example3.cpp | 68 | ||||
| -rwxr-xr-x | library/cpp/lwtrace/example3/start_with_query.sh | 2 | ||||
| -rw-r--r-- | library/cpp/lwtrace/example3/ya.make | 18 |
4 files changed, 53 insertions, 53 deletions
diff --git a/library/cpp/lwtrace/example3/example_query.tr b/library/cpp/lwtrace/example3/example_query.tr index bd22441af3b..1f841b0932a 100644 --- a/library/cpp/lwtrace/example3/example_query.tr +++ b/library/cpp/lwtrace/example3/example_query.tr @@ -1,13 +1,13 @@ -Blocks { - ProbeDesc { - Name: "IterationProbe" - Provider: "LWTRACE_EXAMPLE_PROVIDER" - } - Action { +Blocks { + ProbeDesc { + Name: "IterationProbe" + Provider: "LWTRACE_EXAMPLE_PROVIDER" + } + Action { CustomAction { Name: "MyAction" Opts: "/dev/stdout" } - } -} - + } +} + diff --git a/library/cpp/lwtrace/example3/lwtrace_example3.cpp b/library/cpp/lwtrace/example3/lwtrace_example3.cpp index e4e96fbc668..4493dc0077b 100644 --- a/library/cpp/lwtrace/example3/lwtrace_example3.cpp +++ b/library/cpp/lwtrace/example3/lwtrace_example3.cpp @@ -1,43 +1,43 @@ #include <library/cpp/lwtrace/all.h> #include <google/protobuf/text_format.h> #include "my_action.h" - + #define LWTRACE_EXAMPLE_PROVIDER(PROBE, EVENT, GROUPS, TYPES, NAMES) \ - PROBE(IterationProbe, GROUPS(), TYPES(i32, double), NAMES("n", "result")) \ - /**/ - -LWTRACE_DECLARE_PROVIDER(LWTRACE_EXAMPLE_PROVIDER) -LWTRACE_DEFINE_PROVIDER(LWTRACE_EXAMPLE_PROVIDER) - -void InitLWTrace() { + PROBE(IterationProbe, GROUPS(), TYPES(i32, double), NAMES("n", "result")) \ + /**/ + +LWTRACE_DECLARE_PROVIDER(LWTRACE_EXAMPLE_PROVIDER) +LWTRACE_DEFINE_PROVIDER(LWTRACE_EXAMPLE_PROVIDER) + +void InitLWTrace() { NLWTrace::StartLwtraceFromEnv([=](NLWTrace::TManager& mngr) { mngr.RegisterCustomAction<TMyActionExecutor>(); }); -} - +} + long double Fact(int n) { - if (n < 0) { - ythrow yexception() << "N! is undefined for negative N (" << n << ")"; - } - double result = 1; - for (; n > 1; --n) { - GLOBAL_LWPROBE(LWTRACE_EXAMPLE_PROVIDER, IterationProbe, n, result); - result *= n; - } - return result; -} - -void FactorialCalculator() { - i32 n; - Cout << "Enter a number: "; + if (n < 0) { + ythrow yexception() << "N! is undefined for negative N (" << n << ")"; + } + double result = 1; + for (; n > 1; --n) { + GLOBAL_LWPROBE(LWTRACE_EXAMPLE_PROVIDER, IterationProbe, n, result); + result *= n; + } + return result; +} + +void FactorialCalculator() { + i32 n; + Cout << "Enter a number: "; TString str; - Cin >> n; - double factN = Fact(n); - Cout << n << "! = " << factN << Endl << Endl; -} - -int main() { - InitLWTrace(); - FactorialCalculator(); - return 0; -} + Cin >> n; + double factN = Fact(n); + Cout << n << "! = " << factN << Endl << Endl; +} + +int main() { + InitLWTrace(); + FactorialCalculator(); + return 0; +} diff --git a/library/cpp/lwtrace/example3/start_with_query.sh b/library/cpp/lwtrace/example3/start_with_query.sh index f7f58ef9295..5cd221856f3 100755 --- a/library/cpp/lwtrace/example3/start_with_query.sh +++ b/library/cpp/lwtrace/example3/start_with_query.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/bash echo "Executing program with following trace query:" cat example_query.tr echo -n "Press any key to start program" diff --git a/library/cpp/lwtrace/example3/ya.make b/library/cpp/lwtrace/example3/ya.make index e226b1e0410..c5b31586e96 100644 --- a/library/cpp/lwtrace/example3/ya.make +++ b/library/cpp/lwtrace/example3/ya.make @@ -1,13 +1,13 @@ PROGRAM(lwtrace-example3) - + OWNER(serxa) - -SRCS( + +SRCS( lwtrace_example3.cpp -) - -PEERDIR( +) + +PEERDIR( library/cpp/lwtrace -) - -END() +) + +END() |
