Bug #228 ยป 0001-Make-subbufer-size-always-take-next-power-of-2-for-a.patch
| src/bin/lttng/commands/enable_channels.c | ||
|---|---|---|
|
}
|
||
|
/*
|
||
|
* Convert to the next power of 2
|
||
|
*/
|
||
|
unsigned long get_subbuf_size(long input)
|
||
|
{
|
||
|
int size =0 ;
|
||
|
if( input <= 0 ) {
|
||
|
input = 4096;
|
||
|
}
|
||
|
while( input > 0 ) {
|
||
|
size++;
|
||
|
input = (input >> 1) ;
|
||
|
}
|
||
|
return ( 1 << size );
|
||
|
}
|
||
|
/*
|
||
|
* Add channel to trace session
|
||
|
*/
|
||
|
int cmd_enable_channels(int argc, const char **argv)
|
||
| ... | ... | |
|
break;
|
||
|
case OPT_SUBBUF_SIZE:
|
||
|
/* TODO Replace atol with strtol and check for errors */
|
||
|
chan.attr.subbuf_size = atol(poptGetOptArg(pc));
|
||
|
long subbuf_size = atol(poptGetOptArg(pc))
|
||
|
chan.attr.subbuf_size = get_subbuf_size(subbuf_size);
|
||
|
DBG("Channel subbuf size set to %" PRIu64, chan.attr.subbuf_size);
|
||
|
break;
|
||
|
case OPT_NUM_SUBBUF:
|
||