Click
Loading...
Searching...
No Matches
scheduleinfo.hh
1// -*- c-basic-offset: 4; related-file-name: "../../../elements/standard/scheduleinfo.cc" -*-
2#ifndef CLICK_SCHEDULEINFO_HH
3#define CLICK_SCHEDULEINFO_HH
4#include <click/element.hh>
5CLICK_DECLS
6
7/*
8=c
9
10ScheduleInfo(ELEMENT PARAM, ...)
11
12=s information
13
14specifies scheduling parameters
15
16=io
17
18None
19
20=d
21
22Provides scheduling parameters for specified elements. Each configuration
23argument has the form `ELEMENT PARAM', meaning that the element
24named ELEMENT has scheduling parameter PARAM. Scheduling
25parameters are real numbers that set how often one element should be
26scheduled in relation to another. For example,
27if elements A and B have
28scheduling parameters 2 and 0.5, respectively, then A will be scheduled
292/0.5 = 4 times as often as B. The default scheduling parameter is 1.
30
31ScheduleInfo elements inside a compound element can specify scheduling
32parameters for that compound's components.
33Outer ScheduleInfo elements
34can specify a ``scheduling parameter'' for the compound
35element as a whole. This ``scheduling parameter'' is really a scaling
36factor affecting the compound's components. For example, consider this
37configuration,
38
39 elementclass Compound {
40 i :: InfiniteSource -> output;
41 ScheduleInfo(i 0.5);
42 }
43 c :: Compound -> Discard;
44 ScheduleInfo(c 4);
45
46which is the same as the following configuration, after compound elements
47are expanded.
48
49 c/i :: InfiniteSource -> Discard@3 :: Discard;
50 c/ScheduleInfo@2 :: ScheduleInfo(i 0.5);
51 ScheduleInfo@4 :: ScheduleInfo(c 4);
52
53The name of the first ScheduleInfo element starts with `c/', so it is
54used to look up scheduling parameters for elements named `c/I<whatever>'.
55V<>(This includes all components of the compound element `c'.)
56The second ScheduleInfo element, however, has no slash in its name,
57so it is used to look up all scheduling parameters,
58including scaling factors for compound elements.
59The InfiniteSource's final scaling parameter will be 2:
60the scaling factor 4 times the local scheduling parameter 0.5.
61
62An outer ScheduleInfo element can override local scheduling parameters.
63For example, if the second ScheduleInfo element above was
64
65 ScheduleInfo@4 :: ScheduleInfo(c 4, c/i 10.5)
66
67then the InfiniteSource's final scaling parameter would be 10.5.
68*/
69
70class ScheduleInfo : public Element { public:
71
72 enum { FRAC_BITS = 10 };
73
74 ScheduleInfo();
75
76 const char* class_name() const { return "ScheduleInfo"; }
77
78 int configure_phase() const { return CONFIGURE_PHASE_INFO; }
80
81 bool query(const String&, int&) const;
82 bool query_prefixes(const String&, int&, String&) const;
83 static int query(Element*, ErrorHandler*);
84 static void initialize_task(Element*, Task*, bool sched, ErrorHandler*);
85 static void initialize_task(Element*, Task*, ErrorHandler*);
86 static void join_scheduler(Element*, Task*, ErrorHandler*);
87
88};
89
90
91inline void
92ScheduleInfo::initialize_task(Element* e, Task* t, ErrorHandler* errh)
93{
94 initialize_task(e, t, true, errh);
95}
96
97inline void
98ScheduleInfo::join_scheduler(Element* e, Task* t, ErrorHandler* errh)
99{
100 initialize_task(e, t, true, errh);
101}
102
103CLICK_ENDDECLS
104#endif
Base class for Click elements.
Definition element.hh:42
virtual int configure_phase() const
Return the element's configure phase, which determines the order in which elements are configured and...
Definition element.cc:1308
virtual int configure(Vector< String > &conf, ErrorHandler *errh)
Parse the element's configuration arguments.
Definition element.cc:1372
virtual const char * class_name() const =0
Return the element's class name.
Error reporting class.
Definition error.hh:90
A string of characters.
Definition string.hh:22
Represents a frequently-scheduled computational task.
Definition task.hh:49
Vector template.
Definition vector.hh:111
Click's Element class.