-
Notifications
You must be signed in to change notification settings - Fork 138
/
runcore_subprof.h
136 lines (109 loc) · 3.69 KB
/
runcore_subprof.h
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/* runcore_subprof.h
* Copyright (C) 2001-2012, Parrot Foundation.
* Overview:
* Functions and macros to dispatch opcodes.
*/
#ifndef PARROT_RUNCORE_SUBPROF_H_GUARD
#define PARROT_RUNCORE_SUBPROF_H_GUARD
#include "pmc/pmc_sub.h"
typedef struct subprofile subprofile;
typedef struct callinfo callinfo;
typedef struct lineinfo lineinfo;
typedef struct subprofiledata subprofiledata;
typedef struct subprof_runcore_t Parrot_subprof_runcore_t;
struct callinfo {
/* which sub we called */
subprofile *callee;
/* how often it was called */
UINTVAL count;
/* how many ops where executed in it (including subcalls) */
UINTVAL ops;
/* how many ticks where spent in it (including subcalls) */
UHUGEINTVAL ticks;
};
struct lineinfo {
/* start op of this line */
size_t op_offs;
/* calls made from this line */
callinfo *calls;
/* number of ops executed in this line */
UINTVAL ops;
/* number of CPU ticks spent in this line */
UHUGEINTVAL ticks;
};
struct subprofile {
/* next subprofile according to recursion */
subprofile *rnext;
/* recursion level of this subprofile */
int rcnt;
/* the Sub PMC being profiled by this subprofile* */
PMC *subpmc;
/* the ATTRs of subpmc */
Parrot_Sub_attributes *subattrs;
/* first op of segment */
opcode_t *code_ops;
INTVAL srcline;
char *srcfile;
lineinfo *lines;
int nlines;
/* call chain info */
/* which sub called us */
subprofile *caller;
/* where the call was done */
callinfo *callerci;
/* the active Context for the Sub being profiled */
PMC *ctx;
/* ops/ticks we need to distribute to the caller */
UINTVAL callerops;
UHUGEINTVAL callerticks;
};
#define SUBPROF_TYPE_SUB 1
#define SUBPROF_TYPE_HLL 2
#define SUBPROF_TYPE_OPS 3
struct subprofiledata {
/* the interpreter we're profiling */
Interp *interp;
/* type of profile */
int profile_type;
/* the collected data, maps subpmc -> subprofile */
Hash *sphash;
/* all the pmcs we have to mark */
PMC *markpmcs;
/* the root call data */
lineinfo rootline;
/* maps to expanded debug data */
Hash *seg2debug;
/* the current context */
PMC *cursubpmc;
PMC *curctx;
subprofile *cursp;
/* ticks are added at the end of the op */
UHUGEINTVAL *tickadd;
UHUGEINTVAL *tickadd2;
UHUGEINTVAL starttick;
};
struct subprof_runcore_t {
STRING *name;
int id;
oplib_init_f opinit;
Parrot_runcore_runops_fn_t runops;
Parrot_runcore_destroy_fn_t destroy;
Parrot_runcore_prepare_fn_t prepare_run;
INTVAL flags;
subprofiledata *spdata;
};
/* HEADERIZER BEGIN: src/runcore/subprof.c */
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
void Parrot_runcore_subprof_init(PARROT_INTERP)
__attribute__nonnull__(1);
#define ASSERT_ARGS_Parrot_runcore_subprof_init __attribute__unused__ int _ASSERT_ARGS_CHECK = (\
PARROT_ASSERT_ARG(interp))
/* Don't modify between HEADERIZER BEGIN / HEADERIZER END. Your changes will be lost. */
/* HEADERIZER END: src/runcore/subprof.c */
#endif /* PARROT_RUNCORE_SUBPROF_H_GUARD */
/*
* Local variables:
* c-file-style: "parrot"
* End:
* vim: expandtab shiftwidth=4 cinoptions='\:2=2' :
*/