stackprofx 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +4 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +24 -0
- data/README.md +41 -0
- data/Rakefile +31 -0
- data/ext/extconf.rb +11 -0
- data/ext/ruby_headers/215/id.h +171 -0
- data/ext/ruby_headers/215/internal.h +889 -0
- data/ext/ruby_headers/215/iseq.h +136 -0
- data/ext/ruby_headers/215/method.h +142 -0
- data/ext/ruby_headers/215/node.h +543 -0
- data/ext/ruby_headers/215/ruby_atomic.h +170 -0
- data/ext/ruby_headers/215/thread_native.h +23 -0
- data/ext/ruby_headers/215/thread_pthread.h +56 -0
- data/ext/ruby_headers/215/thread_win32.h +45 -0
- data/ext/ruby_headers/215/vm_core.h +1042 -0
- data/ext/ruby_headers/215/vm_debug.h +37 -0
- data/ext/ruby_headers/215/vm_opts.h +56 -0
- data/ext/stackprofx.c +622 -0
- data/sample.rb +34 -0
- data/stackprofx.gemspec +20 -0
- data/test/test_stackprofx.rb +158 -0
- metadata +113 -0
@@ -0,0 +1,23 @@
|
|
1
|
+
#ifndef RUBY_THREAD_NATIVE_H
|
2
|
+
#define RUBY_THREAD_NATIVE_H
|
3
|
+
|
4
|
+
#if defined(_WIN32)
|
5
|
+
#include "thread_win32.h"
|
6
|
+
#elif defined(HAVE_PTHREAD_H)
|
7
|
+
#include "thread_pthread.h"
|
8
|
+
#else
|
9
|
+
#error "unsupported thread type"
|
10
|
+
#endif
|
11
|
+
|
12
|
+
RUBY_SYMBOL_EXPORT_BEGIN
|
13
|
+
|
14
|
+
rb_nativethread_id_t rb_nativethread_self();
|
15
|
+
|
16
|
+
void rb_nativethread_lock_initialize(rb_nativethread_lock_t *lock);
|
17
|
+
void rb_nativethread_lock_destroy(rb_nativethread_lock_t *lock);
|
18
|
+
void rb_nativethread_lock_lock(rb_nativethread_lock_t *lock);
|
19
|
+
void rb_nativethread_lock_unlock(rb_nativethread_lock_t *lock);
|
20
|
+
|
21
|
+
RUBY_SYMBOL_EXPORT_END
|
22
|
+
|
23
|
+
#endif
|
@@ -0,0 +1,56 @@
|
|
1
|
+
/**********************************************************************
|
2
|
+
|
3
|
+
thread_pthread.h -
|
4
|
+
|
5
|
+
$Author: ko1 $
|
6
|
+
|
7
|
+
Copyright (C) 2004-2007 Koichi Sasada
|
8
|
+
|
9
|
+
**********************************************************************/
|
10
|
+
|
11
|
+
#ifndef RUBY_THREAD_PTHREAD_H
|
12
|
+
#define RUBY_THREAD_PTHREAD_H
|
13
|
+
|
14
|
+
#include <pthread.h>
|
15
|
+
#ifdef HAVE_PTHREAD_NP_H
|
16
|
+
#include <pthread_np.h>
|
17
|
+
#endif
|
18
|
+
typedef pthread_t rb_nativethread_id_t;
|
19
|
+
typedef pthread_mutex_t rb_nativethread_lock_t;
|
20
|
+
|
21
|
+
typedef struct rb_thread_cond_struct {
|
22
|
+
pthread_cond_t cond;
|
23
|
+
#ifdef HAVE_CLOCKID_T
|
24
|
+
clockid_t clockid;
|
25
|
+
#endif
|
26
|
+
} rb_nativethread_cond_t;
|
27
|
+
|
28
|
+
typedef struct native_thread_data_struct {
|
29
|
+
void *signal_thread_list;
|
30
|
+
rb_nativethread_cond_t sleep_cond;
|
31
|
+
} native_thread_data_t;
|
32
|
+
|
33
|
+
#include <semaphore.h>
|
34
|
+
|
35
|
+
#undef except
|
36
|
+
#undef try
|
37
|
+
#undef leave
|
38
|
+
#undef finally
|
39
|
+
|
40
|
+
typedef struct rb_global_vm_lock_struct {
|
41
|
+
/* fast path */
|
42
|
+
unsigned long acquired;
|
43
|
+
pthread_mutex_t lock;
|
44
|
+
|
45
|
+
/* slow path */
|
46
|
+
volatile unsigned long waiting;
|
47
|
+
rb_nativethread_cond_t cond;
|
48
|
+
|
49
|
+
/* yield */
|
50
|
+
rb_nativethread_cond_t switch_cond;
|
51
|
+
rb_nativethread_cond_t switch_wait_cond;
|
52
|
+
int need_yield;
|
53
|
+
int wait_yield;
|
54
|
+
} rb_global_vm_lock_t;
|
55
|
+
|
56
|
+
#endif /* RUBY_THREAD_PTHREAD_H */
|
@@ -0,0 +1,45 @@
|
|
1
|
+
/**********************************************************************
|
2
|
+
|
3
|
+
thread_win32.h -
|
4
|
+
|
5
|
+
$Author: ko1 $
|
6
|
+
|
7
|
+
Copyright (C) 2004-2007 Koichi Sasada
|
8
|
+
|
9
|
+
**********************************************************************/
|
10
|
+
|
11
|
+
/* interface */
|
12
|
+
#ifndef RUBY_THREAD_WIN32_H
|
13
|
+
#define RUBY_THREAD_WIN32_H
|
14
|
+
|
15
|
+
#include <windows.h>
|
16
|
+
|
17
|
+
# ifdef __CYGWIN__
|
18
|
+
# undef _WIN32
|
19
|
+
# endif
|
20
|
+
|
21
|
+
WINBASEAPI BOOL WINAPI
|
22
|
+
TryEnterCriticalSection(IN OUT LPCRITICAL_SECTION lpCriticalSection);
|
23
|
+
|
24
|
+
typedef HANDLE rb_nativethread_id_t;
|
25
|
+
|
26
|
+
typedef union rb_thread_lock_union {
|
27
|
+
HANDLE mutex;
|
28
|
+
CRITICAL_SECTION crit;
|
29
|
+
} rb_nativethread_lock_t;
|
30
|
+
|
31
|
+
typedef struct rb_thread_cond_struct {
|
32
|
+
struct cond_event_entry *next;
|
33
|
+
struct cond_event_entry *prev;
|
34
|
+
} rb_nativethread_cond_t;
|
35
|
+
|
36
|
+
typedef struct native_thread_data_struct {
|
37
|
+
HANDLE interrupt_event;
|
38
|
+
} native_thread_data_t;
|
39
|
+
|
40
|
+
typedef struct rb_global_vm_lock_struct {
|
41
|
+
HANDLE lock;
|
42
|
+
} rb_global_vm_lock_t;
|
43
|
+
|
44
|
+
#endif /* RUBY_THREAD_WIN32_H */
|
45
|
+
|