blob: a14aa90b064e4718a05281ba9e622eeb501267fc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
#!/usr/bin/env python
# Copyright 2016 Cisco Systems, Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
#
import time
from log import LOG
from packet_stats import PacketPathStatsManager
from stats_collector import IntervalCollector
class StatsManager(object):
"""A class to collect detailed stats and handle fixed rate runs for all chain types."""
def __init__(self, chain_runner):
self.chain_runner = chain_runner
self.config = chain_runner.config
self.traffic_client = chain_runner.traffic_client
self.specs = chain_runner.specs
self.notifier = chain_runner.notifier
self.interval_collector = None
self.factory = chain_runner.factory
# create a packet path stats manager for fixed rate runs only
if self.config.single_run:
pps_list = []
self.traffic_client.insert_interface_stats(pps_list)
self.pps_mgr = PacketPathStatsManager(pps_list)
else:
self.pps_mgr = None
self.worker = None
def create_worker(self):
"""Create a worker to fetch custom data.
This is done late as we need to know the dest MAC for all VNFs, which can happen
as late as after ARP discovery.
"""
if not self.worker and
|