Пример #1
0
void logic_init(void)
{
  tstat_init();
  logic_pinger_init();

  unsigned sign;
  EEPROM_READ(&eeprom_logic_signature, &sign, sizeof sign);
  if(sign != logic_signature) logic_reset_params();
  EEPROM_READ(eeprom_logic_setup, logic_setup, sizeof logic_setup);
  EEPROM_READ(&eeprom_logic_flags, &logic_flags, sizeof logic_flags);
  logic_restart();
}
Пример #2
0
		 /**
		   * configures the filter
		   * @param n the xml subtree
		   */
		 virtual void _configure(const xml_node&  n )
		 {
		     xml_node config = n.child("config");
		     xml_node log = n.child("logdir");
		     if(!config or !log)
	                 throw std::runtime_error("TstatAnalyzer: missing parameter");
             std::string cname=config.attribute("name").value();
		     tstat_init((char*)cname.c_str());
             std::string lname=config.attribute("name").value();
		     struct timeval cur_time;
		     gettimeofday(&cur_time,NULL);
		     tstat_new_logdir((char*)lname.c_str(), &cur_time);
		 }
Пример #3
0
/* the thread body.
   1) It does some book keeping and installs the
      exit handler.
   2) if necessary, waits for the first activation
   3) then calls the real user task body
   4) on exit, it cleans up everything */
static void *ptask_std_body(void *arg) {
    struct task_par *pdes = (struct task_par *)arg;

    tspec t;

    ptask_idx = pdes->index;
    if (_tp[ptask_idx].measure_flag)
        tstat_init(ptask_idx);

    pthread_cleanup_push(ptask_exit_handler, 0);
    _tp[ptask_idx].tid = gettid();

    if (ptask_policy == SCHED_DEADLINE) {
        struct sched_attr attr;
        attr.size = sizeof(attr);
        attr.sched_policy = SCHED_DEADLINE;
        attr.sched_flags = SCHED_FLAG_RESET_ON_FORK;
        attr.sched_priority = 0;
        attr.sched_runtime = (__u64)tspec_to(&(_tp[ptask_idx].runtime), NANO);
        attr.sched_period = (__u64)tspec_to(&_tp[ptask_idx].period, NANO);
        attr.sched_deadline = (__u64)tspec_to(&_tp[ptask_idx].deadline, NANO);
        if (sched_setattr(_tp[ptask_idx].tid, &attr, 0) != 0) {
            printf("ERROR in setting sched_deadline parameters!\n");
            perror("Error:");
            return 0;
        }
        _tp[ptask_idx].schedattr = attr;
        // printf("SCHED_DEADLINE correctly set\n");
    }

    if (_tp[ptask_idx].act_flag == DEFERRED)
        ptask_wait_for_activation();
    else {
        clock_gettime(CLOCK_MONOTONIC, &t);
        _tp[ptask_idx].dl = tspec_add(&t, &_tp[ptask_idx].deadline);
        _tp[ptask_idx].at = tspec_add(&t, &_tp[ptask_idx].period);
    }

    
    //dle_init(); /*< init dle handler for this task */ 
    (*pdes->body)();
    //dle_exit(); /*< cleanup dle handler for this task */
    
    pthread_cleanup_pop(1);

    return 0;
}