Bug #1351 » 0001-babeltrace2-handle-negative-clock-offset-v2.patch
src/plugins/ctf/common/metadata/visitor-generate-ir.c | ||
---|---|---|
static
|
||
int visit_clock_decl_entry(struct ctx *ctx, struct ctf_node *entry_node,
|
||
struct ctf_clock_class *clock, int *set, int64_t *offset_seconds,
|
||
uint64_t *offset_cycles)
|
||
int64_t *offset_cycles)
|
||
{
|
||
int ret = 0;
|
||
char *left = NULL;
|
||
... | ... | |
goto error;
|
||
}
|
||
ret = get_unary_unsigned(ctx,
|
||
ret = get_unary_signed(
|
||
&entry_node->u.ctf_expression.right, offset_cycles);
|
||
if (ret) {
|
||
_BT_COMP_LOGE_NODE(entry_node,
|
||
... | ... | |
struct ctf_node *entry_node;
|
||
struct bt_list_head *decl_list = &clock_node->u.clock.declaration_list;
|
||
const char *clock_class_name;
|
||
int64_t offset_seconds = 0;
|
||
int64_t offset_seconds = 0, orig_offset_cycles = 0;
|
||
uint64_t offset_cycles = 0;
|
||
uint64_t freq;
|
||
... | ... | |
bt_list_for_each_entry(entry_node, decl_list, siblings) {
|
||
ret = visit_clock_decl_entry(ctx, entry_node, clock, &set,
|
||
&offset_seconds, &offset_cycles);
|
||
&offset_seconds, &orig_offset_cycles);
|
||
if (ret) {
|
||
_BT_COMP_LOGE_NODE(entry_node,
|
||
"Cannot visit clock class's entry: ret=%d",
|
||
... | ... | |
* frequency (move to the part in seconds).
|
||
*/
|
||
freq = clock->frequency;
|
||
/*converte negative offset attribute value to the offset_s attribute.*/
|
||
if(orig_offset_cycles < 0) {
|
||
offset_seconds -= llabs(orig_offset_cycles) / freq;
|
||
offset_seconds --;
|
||
offset_cycles = freq - llabs(orig_offset_cycles) % freq;
|
||
}
|
||
calibrate_clock_class_offsets(&offset_seconds, &offset_cycles, freq);
|
||
BT_ASSERT(offset_cycles < clock->frequency);
|
||
clock->offset_seconds = offset_seconds;
|