[Cbe-oss-dev] [PATCH] spu-tools: Add TID field to SPU view of spu-top

D. Herrendoerfer d.herrendoerfer at herrendoerfer.name
Fri Jun 6 00:31:30 EST 2008


Applied to svn,

Thank you very much !

D.Herrendoerfer

On Wed, 2008-05-28 at 22:37 -0300, Andre Detsch wrote:
> This patch adds an extra TID column to the per spu view.
> The field corresponds to the controlling thread id of the context
> running at the given SPU.
> 
> Signed-off-by: Andre Detsch <adetsch at br.ibm.com>
> 
> ---
> Field suggested by Luke Browning.
> Dirk, can you apply it?
> 
> 
> Index: libspe2/tools/spu-tools/src/spu-info.c
> ===================================================================
> --- libspe2.orig/tools/spu-tools/src/spu-info.c
> +++ libspe2/tools/spu-tools/src/spu-info.c
> @@ -105,6 +105,9 @@ static int spus_compare(const void *v1, 
>  		case SPU_PPE_LIBRARY:
>  			ret = p1->ppe_library - p2->ppe_library; break;
>  
> +		case SPU_CTX_THREAD_ID:
> +			ret = p1->ctx_thread_id - p2->ctx_thread_id; break;
> +
>  		default :
>  			ret = 0; break;
>  	}
> @@ -218,6 +221,8 @@ struct field spu_fields[] = {
>  	{ SPU_CLASS2_INTERRUPTS,        "IRQ2",    "%6s", "%6llu", "Number of Class2 Interrupts Received",     1, "" },
>  	{ SPU_PPE_LIBRARY,              "PPE_LIB", "%8s", "%8llu", "Number of PPE Assisted Library Calls Performed", 1, "" },
>  
> +	{ SPU_CTX_THREAD_ID,            "TID",     "%6s", "%6d",   "SPE Controlling Thread ID",                0, "" },
> +
>  	{ 0,            NULL,    NULL,      NULL,    NULL,                        0 }
>  };
>  
> @@ -253,9 +258,33 @@ int print_spu_field(struct spu *spu, cha
>  			return sprintf(buf, format, spu->class2_interrupts);
>  		case SPU_PPE_LIBRARY:
>  			return sprintf(buf, format, spu->ppe_library);
> +
> +		case SPU_CTX_THREAD_ID:
> +			return sprintf(buf, format, spu->ctx_thread_id);
> +
>  		default:
>  			return 0;
>  	}
>  }
>  
> 
> +void fill_spus_tids(struct spu** spus, struct ctx** ctxs)
> +{
> +	int i, j;
> +
> +	for (j = 0; spus[j]; j++)
> +		spus[j]->ctx_thread_id = 0;
> +
> +	for (i = 0; ctxs[i]; i++) {
> +		int spe = ctxs[i]->spe;
> +		if (spe < 0)
> +			continue;
> +
> +		for (j = 0; spus[j]; j++) {
> +			if (spus[j]->number == spe) {
> +				spus[j]->ctx_thread_id = ctxs[i]->thread_id;
> +				break;
> +			}
> +		}
> +	}
> +}
> Index: libspe2/tools/spu-tools/src/spu-tools.h
> ===================================================================
> --- libspe2.orig/tools/spu-tools/src/spu-tools.h
> +++ libspe2/tools/spu-tools/src/spu-tools.h
> @@ -148,6 +148,7 @@ enum spu_field_id {
>  	SPU_MAJOR_PAGE_FAULTS,
>  	SPU_CLASS2_INTERRUPTS,
>  	SPU_PPE_LIBRARY,
> +	SPU_CTX_THREAD_ID,
>  	SPU_MAX_FIELD
>  };
>  
> @@ -169,6 +170,8 @@ struct spu {
>  	u64 ppe_library;
>  
>  	float percent[TIME_MAX];
> +
> +	int ctx_thread_id;
>  };
>  
> 
> @@ -183,6 +186,7 @@ inline enum spu_field_id get_spu_sort_fi
>  inline void set_spu_sort_field(enum spu_field_id field);
>  void set_spu_sort_descending(int descending);
>  
> +void fill_spus_tids(struct spu** spus, struct ctx** ctxs);
>  
>  /*
>   * PER_PROC
> Index: libspe2/tools/spu-tools/src/spu-top.c
> ===================================================================
> --- libspe2.orig/tools/spu-tools/src/spu-top.c
> +++ libspe2/tools/spu-tools/src/spu-top.c
> @@ -443,6 +443,7 @@ int main(int argc, char **argv)
>  			spus = get_spus();
>  			ctxs = get_spu_contexts(period);
>  			procs = get_procs(ctxs);
> +			fill_spus_tids(spus, ctxs);
>  			last_time = current_time;
>  		}
>  
> Index: libspe2/tools/spu-tools/spu-tools.spec
> ===================================================================
> --- libspe2.orig/tools/spu-tools/spu-tools.spec
> +++ libspe2/tools/spu-tools/spu-tools.spec
> @@ -1,7 +1,7 @@
>  Summary: user space tools for Cell/B.E.
>  Name: spu-tools
>  Version: 1.1
> -Release: 3
> +Release: 4
>  License: GPL
>  Group: Applications/System
>  Source0: spu-tools.tar.bz2
> @@ -42,6 +42,9 @@ rm -rf $RPM_BUILD_ROOT
>  %dir /%{_prefix}/share/man/man1/spu-ps.1.gz
>  
>  %changelog
> +* Wed May 28 2008  Andre Detsch <adetsch at br.ibm.com> 1.1-4
> +- Added TID field to SPU view of spu-top.
> +
>  * Fri Apr 11 2008  Andre Detsch <adetsch at br.ibm.com> 1.1-3
>  - Fix escape sequences handling on spu-top.
>  - Fixed help example for spu-ps.
> Index: libspe2/tools/spu-tools/src/ChangeLog
> ===================================================================
> --- libspe2.orig/tools/spu-tools/src/ChangeLog
> +++ libspe2/tools/spu-tools/src/ChangeLog
> @@ -1,3 +1,6 @@
> +2008-05-28 Andre Detsch <adetsch at br.ibm.com>
> +	* spu-top: Added TID field to SPU view.
> +
>  2008-04-11 Andre Detsch <adetsch at br.ibm.com>
>  
>  	* spu-top.c: Fix escape sequences handling.




More information about the cbe-oss-dev mailing list