Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i#4219 xl8: Add an rstat on synch xl8 failures #4228

Merged
merged 1 commit into from
Mar 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions core/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,11 @@ typedef struct _dr_stats_t {
uint64 peak_num_threads;
/** Accumulated total number of threads encountered by DR. */
uint64 num_threads_created;
/**
* Thread synchronization attempts retried due to the target thread being at
* an un-translatable spot.
*/
uint64 synchs_not_at_safe_spot;
} dr_stats_t;

/* DR_API EXPORT END */
Expand Down
4 changes: 2 additions & 2 deletions core/lib/instrument_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -6382,8 +6382,8 @@ DR_API
/**
* Retrieves various statistics exported by DR as global, process-wide values.
* The API is not thread-safe.
* The caller is expected to pass a pointer to a valid, initialized dr_stats_t
* value, with the size field set (see dr_stats_t).
* The caller is expected to pass a pointer to a valid, initialized #dr_stats_t
* value, with the size field set (see #dr_stats_t).
* Returns false if stats are not enabled.
*/
bool
Expand Down
1 change: 1 addition & 0 deletions core/lib/statsx.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ STATS_DEF("Cache consistency flushes that flushed nothing", num_empty_flushes)
STATS_DEF("Cache consistency flushes via synchall", flush_synchall)
STATS_DEF("Thread not translated in synchall flush (race)", flush_synchall_races)
STATS_DEF("Thread not synched with in synchall flush", flush_synchall_fail)
RSTATS_DEF("Synch attempt failure b/c not at safe spot", synchs_not_at_safe_spot)
STATS_DEF("Cache consistency coarse units flushed", flush_coarse_units)
STATS_DEF("Cache consistency persisted units flushed", flush_persisted_units)
STATS_DEF("Cache consistency persisted flushed at unload", flush_persisted_unload)
Expand Down
2 changes: 2 additions & 0 deletions core/synch.c
Original file line number Diff line number Diff line change
Expand Up @@ -1064,6 +1064,8 @@ synch_with_thread(thread_id_t id, bool block, bool hold_initexit_lock,
my_id);
res = THREAD_SYNCH_RESULT_SUCCESS;
break;
} else {
RSTATS_INC(synchs_not_at_safe_spot);
}
if (!os_thread_resume(trec)) {
ASSERT_NOT_REACHED();
Expand Down
3 changes: 3 additions & 0 deletions core/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -4606,5 +4606,8 @@ stats_get_snapshot(dr_stats_t *drstats)
}
drstats->peak_num_threads = GLOBAL_STAT(peak_num_threads);
drstats->num_threads_created = GLOBAL_STAT(num_threads_created);
if (drstats->size > offsetof(dr_stats_t, synchs_not_at_safe_spot)) {
drstats->synchs_not_at_safe_spot = GLOBAL_STAT(synchs_not_at_safe_spot);
}
return true;
}