Lines Matching full:self
43 def __init__(self, size=None, nr_accesses=None, age=None): argument
44 self.size = size
45 self.nr_accesses = nr_accesses
46 self.age = age
48 if self.size is None:
49 self.size = [0, 2**64 - 1]
50 if self.nr_accesses is None:
51 self.nr_accesses = [0, 2**64 - 1]
52 if self.age is None:
53 self.age = [0, 2**64 - 1]
55 def sysfs_dir(self): argument
56 return os.path.join(self.scheme.sysfs_dir(), 'access_pattern')
58 def stage(self): argument
60 os.path.join(self.sysfs_dir(), 'sz', 'min'), self.size[0])
64 os.path.join(self.sysfs_dir(), 'sz', 'max'), self.size[1])
67 err = write_file(os.path.join(self.sysfs_dir(), 'nr_accesses', 'min'),
68 self.nr_accesses[0])
71 err = write_file(os.path.join(self.sysfs_dir(), 'nr_accesses', 'max'),
72 self.nr_accesses[1])
76 os.path.join(self.sysfs_dir(), 'age', 'min'), self.age[0])
80 os.path.join(self.sysfs_dir(), 'age', 'max'), self.age[1])
96 def __init__(self, metric, target_value=10000, current_value=0): argument
97 self.metric = metric
98 self.target_value = target_value
99 self.current_value = current_value
101 def sysfs_dir(self): argument
102 return os.path.join(self.quota.sysfs_dir(), 'goals', '%d' % self.idx)
104 def stage(self): argument
105 err = write_file(os.path.join(self.sysfs_dir(), 'target_metric'),
106 self.metric)
109 err = write_file(os.path.join(self.sysfs_dir(), 'target_value'),
110 self.target_value)
113 err = write_file(os.path.join(self.sysfs_dir(), 'current_value'),
114 self.current_value)
126 def __init__(self, sz=0, ms=0, goals=None, reset_interval_ms=0): argument
127 self.sz = sz
128 self.ms = ms
129 self.reset_interval_ms = reset_interval_ms
130 self.goals = goals if goals is not None else []
131 for idx, goal in enumerate(self.goals):
133 goal.quota = self
135 def sysfs_dir(self): argument
136 return os.path.join(self.scheme.sysfs_dir(), 'quotas')
138 def stage(self): argument
139 err = write_file(os.path.join(self.sysfs_dir(), 'bytes'), self.sz)
142 err = write_file(os.path.join(self.sysfs_dir(), 'ms'), self.ms)
145 err = write_file(os.path.join(self.sysfs_dir(), 'reset_interval_ms'),
146 self.reset_interval_ms)
150 nr_goals_file = os.path.join(self.sysfs_dir(), 'goals', 'nr_goals')
154 if int(content) != len(self.goals):
155 err = write_file(nr_goals_file, len(self.goals))
158 for goal in self.goals:
171 def __init__(self, nr_tried, sz_tried, nr_applied, sz_applied, qt_exceeds): argument
172 self.nr_tried = nr_tried
173 self.sz_tried = sz_tried
174 self.nr_applied = nr_applied
175 self.sz_applied = sz_applied
176 self.qt_exceeds = qt_exceeds
179 def __init__(self, start, end, nr_accesses, age): argument
180 self.start = start
181 self.end = end
182 self.nr_accesses = nr_accesses
183 self.age = age
197 def __init__(self, action='stat', access_pattern=DamosAccessPattern(), argument
199 self.action = action
200 self.access_pattern = access_pattern
201 self.access_pattern.scheme = self
202 self.quota = quota
203 self.quota.scheme = self
204 self.apply_interval_us = apply_interval_us
206 def sysfs_dir(self): argument
208 self.context.sysfs_dir(), 'schemes', '%d' % self.idx)
210 def stage(self): argument
211 err = write_file(os.path.join(self.sysfs_dir(), 'action'), self.action)
214 err = self.access_pattern.stage()
217 err = write_file(os.path.join(self.sysfs_dir(), 'apply_interval_us'),
218 '%d' % self.apply_interval_us)
222 err = self.quota.stage()
228 os.path.join(self.sysfs_dir(), 'watermarks', 'metric'), 'none')
234 os.path.join(self.sysfs_dir(), 'filters', 'nr_filters'), '0')
244 def __init__(self, pid): argument
245 self.pid = pid
247 def sysfs_dir(self): argument
249 self.context.sysfs_dir(), 'targets', '%d' % self.idx)
251 def stage(self): argument
253 os.path.join(self.sysfs_dir(), 'regions', 'nr_regions'), '0')
257 os.path.join(self.sysfs_dir(), 'pid_target'), self.pid)
267 def __init__(self, sample_us=5000, aggr_us=100000, update_us=1000000, argument
269 self.sample_us = sample_us
270 self.aggr_us = aggr_us
271 self.update_us = update_us
272 self.min_nr_regions = min_nr_regions
273 self.max_nr_regions = max_nr_regions
275 def interval_sysfs_dir(self): argument
276 return os.path.join(self.context.sysfs_dir(), 'monitoring_attrs',
279 def nr_regions_range_sysfs_dir(self): argument
280 return os.path.join(self.context.sysfs_dir(), 'monitoring_attrs',
283 def stage(self): argument
284 err = write_file(os.path.join(self.interval_sysfs_dir(), 'sample_us'),
285 self.sample_us)
288 err = write_file(os.path.join(self.interval_sysfs_dir(), 'aggr_us'),
289 self.aggr_us)
292 err = write_file(os.path.join(self.interval_sysfs_dir(), 'update_us'),
293 self.update_us)
298 os.path.join(self.nr_regions_range_sysfs_dir(), 'min'),
299 self.min_nr_regions)
304 os.path.join(self.nr_regions_range_sysfs_dir(), 'max'),
305 self.max_nr_regions)
317 def __init__(self, ops='paddr', monitoring_attrs=DamonAttrs(), targets=[], argument
319 self.ops = ops
320 self.monitoring_attrs = monitoring_attrs
321 self.monitoring_attrs.context = self
323 self.targets = targets
324 for idx, target in enumerate(self.targets):
326 target.context = self
328 self.schemes = schemes
329 for idx, scheme in enumerate(self.schemes):
331 scheme.context = self
333 def sysfs_dir(self): argument
334 return os.path.join(self.kdamond.sysfs_dir(), 'contexts',
335 '%d' % self.idx)
337 def stage(self): argument
339 os.path.join(self.sysfs_dir(), 'operations'), self.ops)
342 err = self.monitoring_attrs.stage()
347 self.sysfs_dir(), 'targets', 'nr_targets')
351 if int(content) != len(self.targets):
352 err = write_file(nr_targets_file, '%d' % len(self.targets))
355 for target in self.targets:
361 self.sysfs_dir(), 'schemes', 'nr_schemes')
365 if int(content) != len(self.schemes):
366 err = write_file(nr_schemes_file, '%d' % len(self.schemes))
369 for scheme in self.schemes:
382 def __init__(self, contexts=[]): argument
383 self.contexts = contexts
384 for idx, context in enumerate(self.contexts):
386 context.kdamond = self
388 def sysfs_dir(self): argument
389 return os.path.join(self.kdamonds.sysfs_dir(), '%d' % self.idx)
391 def start(self): argument
392 nr_contexts_file = os.path.join(self.sysfs_dir(),
397 if int(content) != len(self.contexts):
398 err = write_file(nr_contexts_file, '%d' % len(self.contexts))
402 for context in self.contexts:
406 err = write_file(os.path.join(self.sysfs_dir(), 'state'), 'on')
409 def stop(self): argument
410 err = write_file(os.path.join(self.sysfs_dir(), 'state'), 'off')
413 def update_schemes_tried_regions(self): argument
414 err = write_file(os.path.join(self.sysfs_dir(), 'state'),
418 for context in self.contexts:
438 def update_schemes_tried_bytes(self): argument
439 err = write_file(os.path.join(self.sysfs_dir(), 'state'),
443 for context in self.contexts:
451 def update_schemes_stats(self): argument
452 err = write_file(os.path.join(self.sysfs_dir(), 'state'),
456 for context in self.contexts:
468 def update_schemes_effective_quotas(self): argument
469 err = write_file(os.path.join(self.sysfs_dir(), 'state'),
473 for context in self.contexts:
484 def commit(self): argument
485 nr_contexts_file = os.path.join(self.sysfs_dir(),
490 if int(content) != len(self.contexts):
491 err = write_file(nr_contexts_file, '%d' % len(self.contexts))
495 for context in self.contexts:
499 err = write_file(os.path.join(self.sysfs_dir(), 'state'), 'commit')
503 def commit_schemes_quota_goals(self): argument
504 for context in self.contexts:
512 return write_file(os.path.join(self.sysfs_dir(), 'state'),
518 def __init__(self, kdamonds=[]): argument
519 self.kdamonds = kdamonds
520 for idx, kdamond in enumerate(self.kdamonds):
522 kdamond.kdamonds = self
524 def sysfs_dir(self): argument
527 def start(self): argument
528 err = write_file(os.path.join(self.sysfs_dir(), 'nr_kdamonds'),
529 '%s' % len(self.kdamonds))
532 for kdamond in self.kdamonds:
538 def stop(self): argument
539 for kdamond in self.kdamonds: