mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	Gather stats for PRECALL_METHOD. (GH-31259)
This commit is contained in:
		
							parent
							
								
									e19059ecd8
								
							
						
					
					
						commit
						1a6411f573
					
				
					 2 changed files with 14 additions and 2 deletions
				
			
		|  | @ -4451,8 +4451,11 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr | ||||||
|             assert(call_shape.kwnames == NULL); |             assert(call_shape.kwnames == NULL); | ||||||
| #ifdef Py_STATS | #ifdef Py_STATS | ||||||
|             extern int _PySpecialization_ClassifyCallable(PyObject *); |             extern int _PySpecialization_ClassifyCallable(PyObject *); | ||||||
|             _py_stats.opcode_stats[PRECALL_FUNCTION].specialization.failure++; |             SpecializationStats *stats = | ||||||
|             _py_stats.opcode_stats[PRECALL_FUNCTION].specialization.failure_kinds[_PySpecialization_ClassifyCallable(call_shape.callable)]++; |                 &_py_stats.opcode_stats[PRECALL_FUNCTION].specialization; | ||||||
|  |             stats->failure++; | ||||||
|  |             int kind = _PySpecialization_ClassifyCallable(call_shape.callable); | ||||||
|  |             stats->failure_kinds[kind]++; | ||||||
| #endif | #endif | ||||||
|             DISPATCH(); |             DISPATCH(); | ||||||
|         } |         } | ||||||
|  | @ -4493,6 +4496,14 @@ _PyEval_EvalFrameDefault(PyThreadState *tstate, InterpreterFrame *frame, int thr | ||||||
| 
 | 
 | ||||||
|             call_shape.total_args = nargs; |             call_shape.total_args = nargs; | ||||||
|             assert(call_shape.kwnames == NULL); |             assert(call_shape.kwnames == NULL); | ||||||
|  | #ifdef Py_STATS | ||||||
|  |             extern int _PySpecialization_ClassifyCallable(PyObject *); | ||||||
|  |             SpecializationStats *stats = | ||||||
|  |                 &_py_stats.opcode_stats[PRECALL_METHOD].specialization; | ||||||
|  |             stats->failure++; | ||||||
|  |             int kind = _PySpecialization_ClassifyCallable(call_shape.callable); | ||||||
|  |             stats->failure_kinds[kind]++; | ||||||
|  | #endif | ||||||
|             DISPATCH(); |             DISPATCH(); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -176,6 +176,7 @@ print_spec_stats(FILE *out, OpcodeStats *stats) | ||||||
|      * even though we don't specialize them yet. */ |      * even though we don't specialize them yet. */ | ||||||
|     fprintf(out, "    opcode[%d].specializable : 1\n", FOR_ITER); |     fprintf(out, "    opcode[%d].specializable : 1\n", FOR_ITER); | ||||||
|     fprintf(out, "    opcode[%d].specializable : 1\n", PRECALL_FUNCTION); |     fprintf(out, "    opcode[%d].specializable : 1\n", PRECALL_FUNCTION); | ||||||
|  |     fprintf(out, "    opcode[%d].specializable : 1\n", PRECALL_METHOD); | ||||||
|     fprintf(out, "    opcode[%d].specializable : 1\n", UNPACK_SEQUENCE); |     fprintf(out, "    opcode[%d].specializable : 1\n", UNPACK_SEQUENCE); | ||||||
|     for (int i = 0; i < 256; i++) { |     for (int i = 0; i < 256; i++) { | ||||||
|         if (adaptive_opcodes[i]) { |         if (adaptive_opcodes[i]) { | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Mark Shannon
						Mark Shannon