| 1 |
|
| #include <xs.h> |
| 2 |
|
| #include <panda/exception.h> |
| 3 |
|
| |
| 4 |
|
| using namespace xs; |
| 5 |
|
| using panda::string; |
| 6 |
|
| |
| 7 |
|
| MODULE = MyTest PACKAGE = MyTest |
| 8 |
|
| PROTOTYPES: DISABLE |
| 9 |
|
| |
| 10 |
|
| BOOT { |
| 11 |
35 |
| XS_BOOT(MyTest__Cookbook); |
| 12 |
35 |
| XS_BOOT(MyTest__Typemap); |
| 13 |
|
| } |
| 14 |
|
| |
| 15 |
|
| uint64_t bench_sv_payload_get (int count) { |
| 16 |
0 |
| RETVAL = 0; |
| 17 |
|
| struct Epta {}; |
| 18 |
0 |
▶ | for (int i = 0; i < count; ++i) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (int i = 0; i < count; ++i) { |
0 |
0 |
0 |
|
| 19 |
0 |
| RETVAL += (uint64_t)typemap::object::TypemapMarker<Epta>::get(); |
| 20 |
|
| } |
| 21 |
|
| } |
| 22 |
|
| |
| 23 |
|
| void throw_exception(Sv sv) { |
| 24 |
0 |
| throw sv; |
| 25 |
|
| } |
| 26 |
|
| |
| 27 |
|
| void throw_logic_error() { |
| 28 |
0 |
▶ | throw std::logic_error("my-logic-error"); |
Branch: 1 branch
| Branch | True | False | Total |
| throw std::logic_error("my-logic-error"); |
0 |
0 |
0 |
|
| 29 |
|
| } |
| 30 |
|
| |
| 31 |
|
| void throw_backtrace() { |
| 32 |
0 |
| throw panda::exception("my-error"); |
| 33 |
|
| } |
| 34 |
|
| |
| 35 |
|
| uint64_t test_leaks1 (string cls, string meth, int cnt) { |
| 36 |
0 |
| RETVAL = 0; |
| 37 |
0 |
▶ | for (int i = 0; i < cnt; ++i) { |
Branch: 1 branch
| Branch | True | False | Total |
| for (int i = 0; i < cnt; ++i) { |
0 |
0 |
0 |
|
| 38 |
0 |
▶ | Stash stash(cls); |
Branch: 1 branch
| Branch | True | False | Total |
| Stash stash(cls); |
0 |
0 |
0 |
|
| 39 |
0 |
▶ | auto ref = stash.call(meth); |
Branch: 1 branch
| Branch | True | False | Total |
| auto ref = stash.call(meth); |
0 |
0 |
0 |
|
| 40 |
0 |
| RETVAL += (uint64_t)ref.get(); |
| 41 |
0 |
| } |
| 42 |
|
| } |
| 43 |
|
| |
| 44 |
|
| void call_me(Sub s) { |
| 45 |
1 |
▶ | s(); |
Branch: 1 branch
| Branch | True | False | Total |
| s(); |
0 |
1 |
1 |
|
| 46 |
|
| } |