summaryrefslogtreecommitdiffstats
path: root/openmp
diff options
context:
space:
mode:
authorJonathan Peyton <jonathan.l.peyton@intel.com>2016-06-14 19:27:22 +0000
committerJonathan Peyton <jonathan.l.peyton@intel.com>2016-06-14 19:27:22 +0000
commit614bb6618e8aaaa6be0a8b1873722085f97a3ed0 (patch)
tree7a4726363614b2b5b080ab100125f3ca3515c482 /openmp
parente85ba3f58fb7bb1f063fa70f9d2d23c6fef2aa18 (diff)
downloadbcm5719-llvm-614bb6618e8aaaa6be0a8b1873722085f97a3ed0.tar.gz
bcm5719-llvm-614bb6618e8aaaa6be0a8b1873722085f97a3ed0.zip
Fix large overhead with itt notifications on region/barrier name composing
Currently, there is a big overhead in reporting of loop metadata through ittnotify. The pair of functions: __kmp_str_loc_init/__kmp_str_loc_free are replaced with strchr/atoi calls. Thus, a lot of time consuming actions are skipped - many memory allocations/deallocations, heavy string duplication, etc. The loop metadata only needs line and column info from the source string, so no allocations and string splitting actually needed. Patch by Andrey Churbanov Differential Revision: http://reviews.llvm.org/D21309 llvm-svn: 272698
Diffstat (limited to 'openmp')
-rw-r--r--openmp/runtime/src/kmp_itt.inl24
1 files changed, 19 insertions, 5 deletions
diff --git a/openmp/runtime/src/kmp_itt.inl b/openmp/runtime/src/kmp_itt.inl
index cd670a518be..8b9ff6fcaf4 100644
--- a/openmp/runtime/src/kmp_itt.inl
+++ b/openmp/runtime/src/kmp_itt.inl
@@ -348,17 +348,31 @@ __kmp_itt_metadata_loop( ident_t * loc, kmp_uint64 sched_type, kmp_uint64 iterat
}
__itt_string_handle * string_handle = __itt_string_handle_create( "omp_metadata_loop");
- kmp_str_loc_t str_loc = __kmp_str_loc_init( loc->psource, 1 );
+
+ // Parse line and column from psource string: ";file;func;line;col;;"
+ char * s_line;
+ char * s_col;
+ KMP_DEBUG_ASSERT(loc->psource);
+#ifdef __cplusplus
+ s_line = strchr((char*)loc->psource, ';');
+#else
+ s_line = strchr(loc->psource, ';');
+#endif
+ KMP_DEBUG_ASSERT(s_line);
+ s_line = strchr(s_line + 1, ';'); // 2-nd semicolon
+ KMP_DEBUG_ASSERT(s_line);
+ s_line = strchr(s_line + 1, ';'); // 3-rd semicolon
+ KMP_DEBUG_ASSERT(s_line);
+ s_col = strchr(s_line + 1, ';'); // 4-th semicolon
+ KMP_DEBUG_ASSERT(s_col);
kmp_uint64 loop_data[ 5 ];
- loop_data[ 0 ] = str_loc.line;
- loop_data[ 1 ] = str_loc.col;
+ loop_data[ 0 ] = atoi(s_line + 1); // read line
+ loop_data[ 1 ] = atoi(s_col + 1); // read column
loop_data[ 2 ] = sched_type;
loop_data[ 3 ] = iterations;
loop_data[ 4 ] = chunk;
- __kmp_str_loc_free( &str_loc );
-
__itt_metadata_add(metadata_domain, __itt_null, string_handle, __itt_metadata_u64, 5, loop_data);
#endif
} // __kmp_itt_metadata_loop
OpenPOWER on IntegriCloud