raygun-apm 1.1.15.pre3 → 1.1.15.pre4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ext/raygun/bipbuffer.c +138 -0
- data/ext/raygun/bipbuffer.h +76 -0
- data/ext/raygun/rax.c +1947 -0
- data/ext/raygun/rax.h +220 -0
- data/ext/raygun/rax_malloc.h +43 -0
- data/ext/raygun/raygun.h +12 -0
- data/ext/raygun/raygun_coercion.c +338 -0
- data/ext/raygun/raygun_coercion.h +104 -0
- data/ext/raygun/raygun_encoder.c +727 -0
- data/ext/raygun/raygun_encoder.h +69 -0
- data/ext/raygun/raygun_errors.c +8 -0
- data/ext/raygun/raygun_errors.h +9 -0
- data/ext/raygun/raygun_event.c +523 -0
- data/ext/raygun/raygun_event.h +45 -0
- data/ext/raygun/raygun_ext.c +19 -0
- data/ext/raygun/raygun_ext.h +16 -0
- data/ext/raygun/raygun_platform.c +16 -0
- data/ext/raygun/raygun_platform.h +24 -0
- data/ext/raygun/raygun_protocol.h +395 -0
- data/ext/raygun/raygun_ringbuf.c +128 -0
- data/ext/raygun/raygun_ringbuf.h +25 -0
- data/ext/raygun/raygun_trace_context.c +95 -0
- data/ext/raygun/raygun_trace_context.h +35 -0
- data/ext/raygun/raygun_tracer.c +3055 -0
- data/ext/raygun/raygun_tracer.h +203 -0
- data/lib/raygun/apm/version.rb +1 -1
- data/lib/raygun/apm.rb +38 -7
- data/raygun-apm.gemspec +14 -2
- metadata +27 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 951015e52ab264410ea8ae772312573c86551b06c62df659a67c529f584bb5b0
|
|
4
|
+
data.tar.gz: a5e52ec36f96e8f462e151e7ca10246e1de646c4c7ea7a85ad218f3e9abcfed9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 72551a84df6bbd3e96e1045f254ac660ca5f6517095df42314d470f9676a20519e3e66686c117c8057b6252d34288f52cc463424979064edf12d79b7d83cbd67
|
|
7
|
+
data.tar.gz: 19bd8011734932bd59eee337871441b770fd68187662abcbb7781e287085d55849524bc64b557370ff73b53ea0b07944c54d2dade18f0d8cb015ad0d5143a620
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2011, Willem-Hendrik Thiart
|
|
3
|
+
* Use of this source code is governed by a BSD-style license that can be
|
|
4
|
+
* found in the LICENSE file.
|
|
5
|
+
*
|
|
6
|
+
* @file
|
|
7
|
+
* @author Willem Thiart himself@willemthiart.com
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
#include "stdio.h"
|
|
11
|
+
#include <stdlib.h>
|
|
12
|
+
|
|
13
|
+
/* for memcpy */
|
|
14
|
+
#include <string.h>
|
|
15
|
+
|
|
16
|
+
#include "bipbuffer.h"
|
|
17
|
+
|
|
18
|
+
size_t bipbuf_sizeof(const unsigned int size)
|
|
19
|
+
{
|
|
20
|
+
return sizeof(bipbuf_t) + size;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
int bipbuf_unused(const bipbuf_t* me)
|
|
24
|
+
{
|
|
25
|
+
if (1 == me->b_inuse)
|
|
26
|
+
/* distance between region B and region A */
|
|
27
|
+
return (int)(me->a_start - me->b_end);
|
|
28
|
+
else
|
|
29
|
+
return (int)(me->size - me->a_end);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
int bipbuf_size(const bipbuf_t* me)
|
|
33
|
+
{
|
|
34
|
+
return (int)me->size;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
int bipbuf_used(const bipbuf_t* me)
|
|
38
|
+
{
|
|
39
|
+
return (int)((me->a_end - me->a_start) + me->b_end);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
void bipbuf_init(bipbuf_t* me, const unsigned int size)
|
|
43
|
+
{
|
|
44
|
+
me->a_start = me->a_end = me->b_end = 0;
|
|
45
|
+
me->size = size;
|
|
46
|
+
me->b_inuse = 0;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
bipbuf_t *bipbuf_new(const unsigned int size)
|
|
50
|
+
{
|
|
51
|
+
bipbuf_t *me = malloc(bipbuf_sizeof(size));
|
|
52
|
+
if (!me)
|
|
53
|
+
return NULL;
|
|
54
|
+
bipbuf_init(me, size);
|
|
55
|
+
return me;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
void bipbuf_free(bipbuf_t* me)
|
|
59
|
+
{
|
|
60
|
+
free(me);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
int bipbuf_is_empty(const bipbuf_t* me)
|
|
64
|
+
{
|
|
65
|
+
return me->a_start == me->a_end;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/* find out if we should turn on region B
|
|
69
|
+
* ie. is the distance from A to buffer's end less than B to A? */
|
|
70
|
+
static void __check_for_switch_to_b(bipbuf_t* me)
|
|
71
|
+
{
|
|
72
|
+
if (me->size - me->a_end < me->a_start - me->b_end)
|
|
73
|
+
me->b_inuse = 1;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
int bipbuf_offer(bipbuf_t* me, const unsigned char *data, const int size)
|
|
77
|
+
{
|
|
78
|
+
/* not enough space */
|
|
79
|
+
if (bipbuf_unused(me) < size)
|
|
80
|
+
return 0;
|
|
81
|
+
|
|
82
|
+
if (1 == me->b_inuse)
|
|
83
|
+
{
|
|
84
|
+
memcpy(me->data + me->b_end, data, size);
|
|
85
|
+
me->b_end += size;
|
|
86
|
+
}
|
|
87
|
+
else
|
|
88
|
+
{
|
|
89
|
+
memcpy(me->data + me->a_end, data, size);
|
|
90
|
+
me->a_end += size;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
__check_for_switch_to_b(me);
|
|
94
|
+
return size;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
unsigned char *bipbuf_peek(const bipbuf_t* me, const unsigned int size)
|
|
98
|
+
{
|
|
99
|
+
/* make sure we can actually peek at this data */
|
|
100
|
+
if (me->size < me->a_start + size)
|
|
101
|
+
return NULL;
|
|
102
|
+
|
|
103
|
+
if (bipbuf_is_empty(me))
|
|
104
|
+
return NULL;
|
|
105
|
+
|
|
106
|
+
return (unsigned char*)me->data + me->a_start;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
unsigned char *bipbuf_poll(bipbuf_t* me, const unsigned int size)
|
|
110
|
+
{
|
|
111
|
+
if (bipbuf_is_empty(me))
|
|
112
|
+
return NULL;
|
|
113
|
+
|
|
114
|
+
/* make sure we can actually poll this data */
|
|
115
|
+
if (me->size < me->a_start + size)
|
|
116
|
+
return NULL;
|
|
117
|
+
|
|
118
|
+
void *end = me->data + me->a_start;
|
|
119
|
+
me->a_start += size;
|
|
120
|
+
|
|
121
|
+
/* we seem to be empty.. */
|
|
122
|
+
if (me->a_start == me->a_end)
|
|
123
|
+
{
|
|
124
|
+
/* replace a with region b */
|
|
125
|
+
if (1 == me->b_inuse)
|
|
126
|
+
{
|
|
127
|
+
me->a_start = 0;
|
|
128
|
+
me->a_end = me->b_end;
|
|
129
|
+
me->b_end = me->b_inuse = 0;
|
|
130
|
+
}
|
|
131
|
+
else
|
|
132
|
+
/* safely move cursor back to the start because we are empty */
|
|
133
|
+
me->a_start = me->a_end = 0;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
__check_for_switch_to_b(me);
|
|
137
|
+
return end;
|
|
138
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
#ifndef BIPBUFFER_H
|
|
2
|
+
#define BIPBUFFER_H
|
|
3
|
+
|
|
4
|
+
typedef struct
|
|
5
|
+
{
|
|
6
|
+
unsigned long int size;
|
|
7
|
+
|
|
8
|
+
/* region A */
|
|
9
|
+
unsigned int a_start, a_end;
|
|
10
|
+
|
|
11
|
+
/* region B */
|
|
12
|
+
unsigned int b_end;
|
|
13
|
+
|
|
14
|
+
/* is B inuse? */
|
|
15
|
+
int b_inuse;
|
|
16
|
+
|
|
17
|
+
unsigned char data[];
|
|
18
|
+
} bipbuf_t;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Create a new bip buffer.
|
|
22
|
+
*
|
|
23
|
+
* malloc()s space
|
|
24
|
+
*
|
|
25
|
+
* @param[in] size The size of the buffer */
|
|
26
|
+
bipbuf_t *bipbuf_new(const unsigned int size);
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Initialise a bip buffer. Use memory provided by user.
|
|
30
|
+
*
|
|
31
|
+
* No malloc()s are performed.
|
|
32
|
+
*
|
|
33
|
+
* @param[in] size The size of the array */
|
|
34
|
+
void bipbuf_init(bipbuf_t* me, const unsigned int size);
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Free the bip buffer */
|
|
38
|
+
void bipbuf_free(bipbuf_t *me);
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @param[in] data The data to be offered to the buffer
|
|
42
|
+
* @param[in] size The size of the data to be offered
|
|
43
|
+
* @return number of bytes offered */
|
|
44
|
+
int bipbuf_offer(bipbuf_t *me, const unsigned char *data, const int size);
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Look at data. Don't move cursor
|
|
48
|
+
*
|
|
49
|
+
* @param[in] len The length of the data to be peeked
|
|
50
|
+
* @return data on success, NULL if we can't peek at this much data */
|
|
51
|
+
unsigned char *bipbuf_peek(const bipbuf_t* me, const unsigned int len);
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Get pointer to data to read. Move the cursor on.
|
|
55
|
+
*
|
|
56
|
+
* @param[in] len The length of the data to be polled
|
|
57
|
+
* @return pointer to data, NULL if we can't poll this much data */
|
|
58
|
+
unsigned char *bipbuf_poll(bipbuf_t* me, const unsigned int size);
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* @return the size of the bipbuffer */
|
|
62
|
+
int bipbuf_size(const bipbuf_t* me);
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* @return 1 if buffer is empty; 0 otherwise */
|
|
66
|
+
int bipbuf_is_empty(const bipbuf_t* me);
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* @return how much space we have assigned */
|
|
70
|
+
int bipbuf_used(const bipbuf_t* cb);
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* @return bytes of unused space */
|
|
74
|
+
int bipbuf_unused(const bipbuf_t* me);
|
|
75
|
+
|
|
76
|
+
#endif /* BIPBUFFER_H */
|