diff options
author | Raghavendra Talur <rtalur@redhat.com> | 2017-07-18 11:36:19 +0530 |
---|---|---|
committer | Jeff Darcy <jeff@pl.atyp.us> | 2017-07-19 14:16:19 +0000 |
commit | 33db9aff1deaa028f30516e49fdb1e8d6e31bb73 (patch) | |
tree | 36d88c93e1e83e4253b154199b0b12531d0edb39 /xlators/features/changelog/lib/src | |
parent | 5ccf0922208c368873120e235be0fd2975a589c1 (diff) |
libglusterfs: Name threads on creation
Set names to threads on creation for easier
debugging.
Output of top -H -p <PID-OF-GLUSTERFSD>
Before:
19773 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd
19774 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd
19775 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd
19776 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd
19777 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd
19778 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd
19779 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd
19780 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd
19781 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd
19782 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd
19783 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd
19784 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd
19785 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.01 glusterfsd
19786 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.01 glusterfsd
19787 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.01 glusterfsd
19789 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd
19790 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd
25178 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd
5398 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd
7881 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd
After:
19773 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd
19774 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glustertimer
19775 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterfsd
19776 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glustermemsweep
19777 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glustersproc0
19778 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glustersproc1
19779 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterepoll0
19780 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusteridxwrker
19781 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusteriotwr0
19782 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterbrssign
19783 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterbrswrker
19784 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterclogecon
19785 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.01 glusterclogd0
19786 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.01 glusterclogd1
19787 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.01 glusterclogd2
19789 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterposixjan
19790 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterposixfsy
25178 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterepoll1
5398 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterepoll2
7881 root 20 0 1301.3m 12.6m 8.4m S 0.0 0.1 0:00.00 glusterposixhc
Change-Id: Id5f333755c1ba168a2ffaa4fce6e71c375e10703
BUG: 1254002
Updates: #271
Signed-off-by: Raghavendra Talur <rtalur@redhat.com>
Reviewed-on: https://review.gluster.org/11926
Reviewed-by: Prashanth Pai <ppai@redhat.com>
Smoke: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'xlators/features/changelog/lib/src')
3 files changed, 16 insertions, 9 deletions
diff --git a/xlators/features/changelog/lib/src/gf-changelog-journal-handler.c b/xlators/features/changelog/lib/src/gf-changelog-journal-handler.c index 2f197eed318..e490069a165 100644 --- a/xlators/features/changelog/lib/src/gf-changelog-journal-handler.c +++ b/xlators/features/changelog/lib/src/gf-changelog-journal-handler.c @@ -805,8 +805,8 @@ gf_changelog_init_processor (gf_changelog_journal_t *jnl) jnl_proc->waiting = _gf_false; jnl->jnl_proc = jnl_proc; - ret = pthread_create (&jnl_proc->processor, - NULL, gf_changelog_process, jnl); + ret = gf_thread_create (&jnl_proc->processor, + NULL, gf_changelog_process, jnl, "clogproc"); if (ret != 0) { jnl->jnl_proc = NULL; goto cleanup_cond; diff --git a/xlators/features/changelog/lib/src/gf-changelog.c b/xlators/features/changelog/lib/src/gf-changelog.c index 75891635827..0e5a2c844e0 100644 --- a/xlators/features/changelog/lib/src/gf-changelog.c +++ b/xlators/features/changelog/lib/src/gf-changelog.c @@ -307,7 +307,7 @@ gf_init_event (gf_changelog_t *entry) } ret = gf_thread_create (&ev->invoker, NULL, - gf_changelog_callback_invoker, ev); + gf_changelog_callback_invoker, ev, "clogcbki"); if (ret != 0) { entry->pickevent = NULL; entry->queueevent = NULL; @@ -462,7 +462,8 @@ gf_changelog_set_master (xlator_t *master, void *xl) if (!xl) { /* poller thread */ ret = gf_thread_create (&priv->poller, - NULL, changelog_rpc_poller, THIS); + NULL, changelog_rpc_poller, THIS, + "clogpoll"); if (ret != 0) { GF_FREE (priv); gf_msg (master->name, GF_LOG_ERROR, 0, @@ -503,7 +504,8 @@ gf_changelog_init (void *xl) priv = master->private; ret = gf_thread_create (&priv->connectionjanitor, NULL, - gf_changelog_connection_janitor, master); + gf_changelog_connection_janitor, master, + "clogjan"); if (ret != 0) { /* TODO: cleanup priv, mutex (poller thread for !xl) */ goto dealloc_name; diff --git a/xlators/features/changelog/lib/src/gf-history-changelog.c b/xlators/features/changelog/lib/src/gf-history-changelog.c index 0c2320097d4..4355396a147 100644 --- a/xlators/features/changelog/lib/src/gf-history-changelog.c +++ b/xlators/features/changelog/lib/src/gf-history-changelog.c @@ -569,6 +569,7 @@ gf_history_consume (void * data) gf_changelog_history_data_t *hist_data = NULL; gf_changelog_consume_data_t ccd[MAX_PARALLELS] = {{0},}; gf_changelog_consume_data_t *curr = NULL; + char thread_name[GF_THREAD_NAMEMAX] = {0,}; hist_data = (gf_changelog_history_data_t *) data; if (hist_data == NULL) { @@ -614,9 +615,12 @@ gf_history_consume (void * data) curr->retval = 0; memset (curr->changelog, '\0', PATH_MAX); + snprintf (thread_name, sizeof(thread_name), "%s%d", + "clogc", iter + 1); - ret = pthread_create (&th_id[iter], NULL, - gf_changelog_consume_wrap, curr); + ret = gf_thread_create (&th_id[iter], NULL, + gf_changelog_consume_wrap, curr, + thread_name); if (ret) { gf_msg (this->name, GF_LOG_ERROR, ret, CHANGELOG_LIB_MSG_THREAD_CREATION_FAILED @@ -953,8 +957,9 @@ gf_history_changelog (char* changelog_dir, unsigned long start, } /* spawn a thread for background parsing & publishing */ - ret = pthread_create (&consume_th, &attr, - gf_history_consume, hist_data); + ret = gf_thread_create (&consume_th, &attr, + gf_history_consume, hist_data, + "cloghcon"); if (ret) { gf_msg (this->name, GF_LOG_ERROR, ret, CHANGELOG_LIB_MSG_THREAD_CREATION_FAILED |