Repository navigation
trace: convert trace time stamp to ticks - #1358
Conversation
xiulipan
left a comment
There was a problem hiding this comment.
The clock usage seems not like other user. Please take reference and made some modification.
There was a problem hiding this comment.
@bardliao
Maybe this way?
| return clk_pdata->clk[clock].ticks_per_msec / 1000 * ns / 1000; | |
| return clk_pdata->clk[clock].ticks_per_msec * ns / 1000000; |
There was a problem hiding this comment.
@xiulipan It is a trade-off between overflow and accuracy. It may overflow when clk_pdata->clk[clock].ticks_per_msec * ns
There was a problem hiding this comment.
Then maybe add a comment here to explain the overflow risk.
There was a problem hiding this comment.
@bardliao would it be easier to use the clock here in this calculation since it will be in MHz (multiplied by 1000 it will be same timebase as host ns) ?
There was a problem hiding this comment.
@lgirdwood Sorry I didn't get you. I think the clock here is an index, right? Did you mean something like double clock; in logger? I didn't find a similar variable here.
There was a problem hiding this comment.
Why made this to a global variable?
You can take reference to other clock user like: sch->clock or just use PLATFORM_DEFAULT_CLOCK
There was a problem hiding this comment.
This here is too complex, you can reference clock_ms_to_ticks user to simplify here.
There was a problem hiding this comment.
@xiulipan Updated. But I don't know if using PLATFORM_DEFAULT_CLOCK is always right. for example, On baytrail, the .clk is PLATFORM_WORKQ_CLOCK, but the PLATFORM_DEFAULT_CLOCK is CLK_SSP
There was a problem hiding this comment.
@bardliao
Then maybe you can take reference of sch->clock to pre define it for different platform.
There was a problem hiding this comment.
Existing clock_ms_to_ticks() is used with the PLATFORM_DEFAULT_CLOCK in many places assuming this is correct define.
Wrt to BYT see this define:
/* platform WorkQ clock */
#define PLATFORM_WORKQ_CLOCK PLATFORM_DEFAULT_CLOCK|
@bardliao |
@xiulipan The linux part is on thesofproject/linux#756 |
@lgirdwood Yes, done. |
|
@bkokoszx |
There was a problem hiding this comment.
assign ticks to nanosecond?
There was a problem hiding this comment.
I've also think that _ns is bit misleading here.
There was a problem hiding this comment.
@bardliao external host IPC uses nanosecs, internal uses local time domain (which will be different for each platform)
There was a problem hiding this comment.
@bardliao
I think the _ns is already with timestamp_ns. No need for delta.
There was a problem hiding this comment.
Yes, thanks everyone. The _ns here is a mistake. I will fix it then
There was a problem hiding this comment.
@bardliao external host IPC uses nanosecs, internal uses local time domain (which will be different for each platform)
There was a problem hiding this comment.
@bardliao would it be easier to use the clock here in this calculation since it will be in MHz (multiplied by 1000 it will be same timebase as host ns) ?
There was a problem hiding this comment.
Why do we need this extern structure ?
There was a problem hiding this comment.
@lgirdwood I need to know the clk id of platform_timer (eg. CLK_SSP) which is platform dependency.
The unit of trace header timestamp is ticks but it is nanosecond in trace params. So we have to convert it to ticks. Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com>
|
@mmaka1 Thanks for the comments. The PR has updated. thanks. |
|
@bardliao is the kernel part ready for merging yet ? |
@lgirdwood I think basically @plbossart agree with that PR, but we need to deal with the missing ABI minor 6 issue. Please see thesofproject/linux#756 (comment) |
|
@bardliao I guess the kernel change is already merged? Is this one good to go? |
xiulipan
left a comment
There was a problem hiding this comment.
Code LGTM
I will try to run some test later.
@tlauda Yes, the kernel change is already merged. thesofproject/linux#756 |
Now outdated, changes made to simplify further.
The unit of trace header timestamp is ticks but it is nanosecond
in trace params. So we have to convert it to ticks.
Signed-off-by: Bard Liao yung-chuan.liao@linux.intel.com