public inbox for trinity@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [patch] perf_event_open more likely tracepoint values
  2013-11-14 17:35 [patch] perf_event_open more likely tracepoint values Vince Weaver
@ 2013-11-14 17:33 ` Dave Jones
  2013-11-15 20:45   ` Vince Weaver
  0 siblings, 1 reply; 3+ messages in thread
From: Dave Jones @ 2013-11-14 17:33 UTC (permalink / raw)
  To: Vince Weaver; +Cc: trinity

On Thu, Nov 14, 2013 at 12:35:27PM -0500, Vince Weaver wrote:
 
 > Tracepoint ids tend to be relatively small (less than 1024 or so).
 > This change makes it more likely to hit valid ones.
 > 
 > Once the fix to avoid the troublesome 0x18 (irq_work_exit)
 > tracepoint gets into the kernel maybe we can start stressing
 > things with trinity again.
 
applied, though fyi, this (and some other boolean choices) could
be shorter with just

	if (rand_bool())
		foo
	else
		bar

guess it depends if you foresee adding further case's though.

thanks,

	Dave

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [patch] perf_event_open more likely tracepoint values
@ 2013-11-14 17:35 Vince Weaver
  2013-11-14 17:33 ` Dave Jones
  0 siblings, 1 reply; 3+ messages in thread
From: Vince Weaver @ 2013-11-14 17:35 UTC (permalink / raw)
  To: Dave Jones; +Cc: trinity


Tracepoint ids tend to be relatively small (less than 1024 or so).
This change makes it more likely to hit valid ones.

Once the fix to avoid the troublesome 0x18 (irq_work_exit)
tracepoint gets into the kernel maybe we can start stressing
things with trinity again.

Signed-off-by: Vince Weaver <vincent.weaver@maine.edu>


diff --git a/syscalls/perf_event_open.c b/syscalls/perf_event_open.c
index 2ff004e..516172a 100644
--- a/syscalls/perf_event_open.c
+++ b/syscalls/perf_event_open.c
@@ -723,9 +723,20 @@ static long long random_event_config(__u32 *event_type,
 		break;
 	case PERF_TYPE_TRACEPOINT:
 		/* Actual values to use can be found under */
-		/* debugfs tracing/events// *//*/id        */
-		/* usually a small < 1024 number           */
-		config = rand64();
+		/* debugfs tracing/events/?*?/?*?/id       */
+		/* usually a small < 4096 number           */
+		switch(rand()%2) {
+		case 0:
+			/* Try a value < 4096 */
+			config = rand()&0xfff;
+			break;
+		case 1:
+			config = rand64();
+			break;
+		default:
+			config = rand64();
+			break;
+		}
 		break;
 	case PERF_TYPE_HW_CACHE:
 		config = random_cache_config();

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [patch] perf_event_open more likely tracepoint values
  2013-11-14 17:33 ` Dave Jones
@ 2013-11-15 20:45   ` Vince Weaver
  0 siblings, 0 replies; 3+ messages in thread
From: Vince Weaver @ 2013-11-15 20:45 UTC (permalink / raw)
  To: Dave Jones; +Cc: trinity

On Thu, 14 Nov 2013, Dave Jones wrote:

> On Thu, Nov 14, 2013 at 12:35:27PM -0500, Vince Weaver wrote:
>  
>  > Tracepoint ids tend to be relatively small (less than 1024 or so).
>  > This change makes it more likely to hit valid ones.
>  > 
>  > Once the fix to avoid the troublesome 0x18 (irq_work_exit)
>  > tracepoint gets into the kernel maybe we can start stressing
>  > things with trinity again.
>  
> applied, though fyi, this (and some other boolean choices) could
> be shorter with just
> 
> 	if (rand_bool())
> 		foo
> 	else
> 		bar
> 
> guess it depends if you foresee adding further case's though.

I wasn't sure of rand_bool() was only meant for setting boolean flag 
variables or if it should be also used as the generic "choose one of two 
options" selector.  

I'll start using it instead of rand()%2 in future patches.

Vince

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-11-15 20:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-14 17:35 [patch] perf_event_open more likely tracepoint values Vince Weaver
2013-11-14 17:33 ` Dave Jones
2013-11-15 20:45   ` Vince Weaver

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox