Exemplo n.º 1
0
 double FMLPAnalysis::holding_time(const TaskRes &task, const CriticalSection &req)
 {
     // of course, req must be a long resource
     double tot = req.get_duration();
     CSSet work = short_outermost_cs(req.begin(), req.end());
     for (auto cs : work) {
         Resource r = get_res(req.get_resource());
         tot += compute_spin(task, r);
     } 
     return tot;
 }
Exemplo n.º 2
0
    CSSet FMLPAnalysis::short_outermost_cs(CSSet::const_iterator begin, CSSet::const_iterator end) const
    {
        stack<CriticalSection> s;
        for (auto i = begin; i != end; ++i) s.push(*i);
        CSSet work;
        while(s.size() >0) {
            CriticalSection cs = s.top();
            s.pop();
            Resource r = get_res(cs.get_resource());
            if (r.is_short()) work.push_back(cs);
            else 
                for (auto i = cs.begin(); i!=cs.end(); ++i) s.push(*i);
        }

        return work;
    }