[go: up one dir, main page]

File: script-python.h

package info (click to toggle)
uftrace 0.18.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,356 kB
  • sloc: ansic: 49,770; python: 11,181; asm: 837; makefile: 769; sh: 637; cpp: 627; javascript: 191
file content (41 lines) | stat: -rw-r--r-- 942 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
 * Python script binding for function entry and exit
 *
 * Copyright (C) 2017, LG Electronics, Honggyu Kim <hong.gyu.kim@lge.com>
 *
 * Released under the GPL v2.
 */
#ifndef UFTRACE_SCRIPT_PYTHON_H
#define UFTRACE_SCRIPT_PYTHON_H

#include "utils/filter.h"

struct script_info;

#if defined(HAVE_LIBPYTHON2) || defined(HAVE_LIBPYTHON3)

#undef _XOPEN_SOURCE
#undef _POSIX_C_SOURCE
#define PY_SSIZE_T_CLEAN
#include <Python.h>

#define SCRIPT_PYTHON_ENABLED 1
int script_init_for_python(struct script_info *info, enum uftrace_pattern_type ptype);
void script_finish_for_python(void);

#else /* HAVE_LIBPYTHON2 */

/* Do nothing if libpython2.7.so is not installed. */
#define SCRIPT_PYTHON_ENABLED 0
static inline int script_init_for_python(struct script_info *info, enum uftrace_pattern_type ptype)
{
	return -1;
}

static inline void script_finish_for_python(void)
{
}

#endif /* HAVE_LIBPYTHON2 */

#endif /* UFTRACE_SCRIPT_PYTHON_H */