1 # Copyright 2015 Intel Corporation.
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
7 # http://www.apache.org/licenses/LICENSE-2.0
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
15 """Abstract "system metrics logger" model.
18 class ICollector(object):
19 """This is an abstract class for system metrics loggers.
23 """Starts data collection. This method must be non-blocking.
24 It means, that collector must be executed as a background process.
26 Where implemented, this function should raise an exception on
29 raise NotImplementedError('Please call an implementation.')
32 """Stops data collection.
34 Where implemented, this function should raise an exception on
37 raise NotImplementedError('Please call an implementation.')
39 def get_results(self):
40 """Returns collected results.
42 Where implemented, this function should raise an exception on
45 raise NotImplementedError('Please call an implementation.')
47 def print_results(self):
48 """Logs collected results.
50 Where implemented, this function should raise an exception on
53 raise NotImplementedError('Please call an implementation.')
56 """Starts up collection of statistics
60 def __exit__(self, type_, value, traceback):
61 """Stops collection of statistics