File tree Expand file tree Collapse file tree 4 files changed +17
-5
lines changed Expand file tree Collapse file tree 4 files changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -9,3 +9,6 @@ Frequently Asked Questions
9
9
10
10
* **What do the colors on vmprof.com mean? **: For plain CPython there is no particular meaning, we might change
11
11
that in the future. For PyPy we have a color coding to show at which state the VM sampled (e.g. JIT, Warmup, ...).
12
+
13
+ * **My Windows profile is malformed? **: Please ensure that you open the file in binary mode. Otherwise Windows
14
+ will transform `\n ` to `\r\n `.
Original file line number Diff line number Diff line change @@ -48,7 +48,13 @@ static struct profbuf_s *volatile current_codes;
48
48
* is 4, but fails on win32
49
49
*/
50
50
typedef struct prof_stacktrace_s {
51
+ #ifdef VMPROF_WINDOWS
52
+ // if padding is 8 bytes, then on both 32bit and 64bit, the
53
+ // stack field is aligned
54
+ char padding [sizeof (void * ) - 1 ];
55
+ #else
51
56
char padding [sizeof (long ) - 1 ];
57
+ #endif
52
58
char marker ;
53
59
long count , depth ;
54
60
void * stack [];
Original file line number Diff line number Diff line change @@ -86,10 +86,8 @@ long __stdcall vmprof_mainloop(void *arg)
86
86
continue ;
87
87
depth = vmprof_snapshot_thread (tstate -> thread_id , tstate , stack );
88
88
if (depth > 0 ) {
89
- // see note in vmprof_common.h on the prof_stacktrace_s struct why
90
- // there are two vmpr_write_all calls
91
- vmp_write_all ((char * )stack + offsetof(prof_stacktrace_s , marker ), SIZEOF_PROF_STACKTRACE );
92
- vmp_write_all ((char * )stack -> stack , depth * sizeof (void * ));
89
+ vmp_write_all ((char * )stack + offsetof(prof_stacktrace_s , marker ),
90
+ SIZEOF_PROF_STACKTRACE + depth * sizeof (void * ));
93
91
}
94
92
}
95
93
}
@@ -121,4 +119,5 @@ int vmprof_disable(void)
121
119
RPY_EXTERN
122
120
void vmprof_ignore_signals (int ignored )
123
121
{
122
+ enabled = !ignored ;
124
123
}
Original file line number Diff line number Diff line change
1
+ import sys
1
2
import os
2
3
from time import time
3
4
import vmprof
@@ -48,7 +49,10 @@ def test():
48
49
49
50
PROFILE_FILE = 'vmprof_cpuburn.dat'
50
51
51
- outfd = os .open (PROFILE_FILE , os .O_RDWR | os .O_CREAT | os .O_TRUNC )
52
+ flags = os .O_RDWR | os .O_CREAT | os .O_TRUNC
53
+ if sys .platform == 'win32' :
54
+ flags |= os .O_BINARY
55
+ outfd = os .open (PROFILE_FILE , flags )
52
56
vmprof .enable (outfd , period = 0.01 )
53
57
test ()
54
58
vmprof .disable ()
You can’t perform that action at this time.
0 commit comments