static unsigned int get_hyperperiod(stochastic_taskset * ts) { unsigned int hyperperiod = 0; unsigned int i = 0; if (ts->tasks_num == 1) { return ts->task_list[0]->period; } for (i = 1; i < ts->tasks_num; i++) { if (i == 1) { hyperperiod = get_lcm(ts->task_list[0]->period, ts->task_list[1]->period); } else { hyperperiod = get_lcm(hyperperiod, ts->task_list[i]->period); } } return hyperperiod; }
inline spair_t *generate_spair(const nelts_t gen1, const nelts_t gen2, const gb_t *basis, mp_cf4_ht_t *ht) { spair_t *sp = (spair_t *)malloc(sizeof(spair_t)); /* we have to fix the positions where the new basis element is put (gen2), * since we are trying to remove as much as possible useless elements in * select_pairs(). if we would dynamically adjust the positioning (as done in * the below commented out code) we could no longer track this correctly. */ sp->gen1 = gen2; sp->gen2 = gen1; /* if (basis->nt[gen1] < basis->nt[gen2]) { sp->gen1 = gen1; sp->gen2 = gen2; } else { sp->gen1 = gen2; sp->gen2 = gen1; } */ sp->lcm = get_lcm(basis->eh[gen1][0], basis->eh[gen2][0], ht); sp->nt = basis->nt[gen1] + basis->nt[gen2]; sp->deg = ht->deg[sp->lcm]; /* if one of the generators is redundant we can stop already here and mark it * with the CHAIN_CRIT in order to remove it later on */ if (basis->red[gen2] > 0) { /* sp->crit = CHAIN_CRIT; */ sp->crit = PROD_CRIT; return sp; } /* check for product criterion and mark correspondingly, i.e. we set sp->deg=0 */ if (sp->deg == ht->deg[basis->eh[gen1][0]] + ht->deg[basis->eh[gen2][0]]) { sp->crit = PROD_CRIT; return sp; } /* else */ sp->crit = NO_CRIT; return sp; }