aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/lwtrace/example1/lwtrace_example1.cpp
diff options
context:
space:
mode:
authorCthulhu <cthulhu@yandex-team.ru>2022-02-10 16:47:44 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:47:44 +0300
commit6aced6c854653b75aab9808d5995be5fc4d9fa53 (patch)
treec0748b5dcbade83af788c0abfa89c0383d6b779c /library/cpp/lwtrace/example1/lwtrace_example1.cpp
parentbcb3e9d0eb2a8188a6a9fe0907a8949ce4881a4e (diff)
downloadydb-6aced6c854653b75aab9808d5995be5fc4d9fa53.tar.gz
Restoring authorship annotation for Cthulhu <cthulhu@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/lwtrace/example1/lwtrace_example1.cpp')
-rw-r--r--library/cpp/lwtrace/example1/lwtrace_example1.cpp70
1 files changed, 35 insertions, 35 deletions
diff --git a/library/cpp/lwtrace/example1/lwtrace_example1.cpp b/library/cpp/lwtrace/example1/lwtrace_example1.cpp
index b196a49afb..6b32c405ee 100644
--- a/library/cpp/lwtrace/example1/lwtrace_example1.cpp
+++ b/library/cpp/lwtrace/example1/lwtrace_example1.cpp
@@ -1,39 +1,39 @@
#include <library/cpp/lwtrace/all.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() {
- NLWTrace::StartLwtraceFromEnv();
-}
-
+ 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();
+}
+
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;
+}