this repo has no description
1// Copyright (c) Facebook, Inc. and its affiliates. (http://www.facebook.com)
2#include "valgrind/callgrind.h"
3
4#include "builtins.h"
5#include "frame.h"
6#include "handles.h"
7#include "modules.h"
8#include "runtime.h"
9#include "thread.h"
10
11namespace py {
12
13RawObject FUNC(_valgrind, callgrind_dump_stats)(Thread* thread,
14 Arguments args) {
15 HandleScope scope(thread);
16 Object description(&scope, args.get(0));
17 if (description.isNoneType()) {
18 CALLGRIND_DUMP_STATS;
19 return NoneType::object();
20 }
21 if (!thread->runtime()->isInstanceOfStr(*description)) {
22 return thread->raiseRequiresType(description, ID(str));
23 }
24 Str description_str(&scope, strUnderlying(*description));
25 unique_c_ptr<char> description_cstr(description_str.toCStr());
26 CALLGRIND_DUMP_STATS_AT(description_cstr.get());
27 return NoneType::object();
28}
29
30RawObject FUNC(_valgrind, callgrind_start_instrumentation)(Thread*, Arguments) {
31 CALLGRIND_START_INSTRUMENTATION;
32 return NoneType::object();
33}
34
35RawObject FUNC(_valgrind, callgrind_stop_instrumentation)(Thread*, Arguments) {
36 CALLGRIND_STOP_INSTRUMENTATION;
37 return NoneType::object();
38}
39
40RawObject FUNC(_valgrind, callgrind_zero_stats)(Thread*, Arguments) {
41 CALLGRIND_ZERO_STATS;
42 return NoneType::object();
43}
44
45} // namespace py