aboutsummaryrefslogtreecommitdiffstats
path: root/ansible/roles/install_dpdk_shared
AgeCommit message (Expand)AuthorFilesLines
2018-04-11Add support for dpdk 17.05John O Loughlin3-11/+10
2017-09-29replace ansible modulesRoss Brattain1-15/+8
2017-09-28add collectd ansibleRoss Brattain5-0/+183
*/ .highlight .ge { font-style: italic } /* Generic.Emph */ .highlight .gr { color: #aa0000 } /* Generic.Error */ .highlight .gh { color: #333333 } /* Generic.Heading */ .highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */ .highlight .go { color: #888888 } /* Generic.Output */ .highlight .gp { color: #555555 } /* Generic.Prompt */ .highlight .gs { font-weight: bold } /* Generic.Strong */ .highlight .gu { color: #666666 } /* Generic.Subheading */ .highlight .gt { color: #aa0000 } /* Generic.Traceback */ .highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */ .highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */ .highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */ .highlight .kp { color: #008800 } /* Keyword.Pseudo */ .highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */ .highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */ .highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */ .highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */ .highlight .na { color: #336699 } /* Name.Attribute */ .highlight .nb { color: #003388 } /* Name.Builtin */ .highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */ .highlight .no { color: #003366; font-weight: bold } /* Name.Constant */ .highlight .nd { color: #555555 } /* Name.Decorator */ .highlight .ne { color: #bb0066; font-weight: bold } /* Name.Exception */ .highlight .nf { color: #0066bb; font-weight: bold } /* Name.Function */ .highlight .nl { color: #336699; font-style: italic } /* Name.Label */ .highlight .nn { color: #bb0066; font-weight: bold } /* Name.Namespace */ .highlight .py { color: #336699; font-weight: bold } /* Name.Property */ .highlight .nt { color: #bb0066; font-weight: bold } /* Name.Tag */ .highlight .nv { color: #336699 } /* Name.Variable */ .highlight .ow { color: #008800 } /* Operator.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
##############################################################################
# Copyright (c) 2016 ZTE Corporation and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################

"""
PoC of performance profiler for OPNFV doctor project

Usage:

Export environment variables to set timestamp at each checkpoint in millisecond.
Valid check points are: DOCTOR_PROFILER_T{00-09}

See also: https://goo.gl/98Osig
"""

import json
import os

OUTPUT = 'doctor_profiling_output'
PREFIX = 'DOCTOR_PROFILER'
TOTAL_CHECK_POINTS = 10
MODULE_CHECK_POINTS = ['T00', 'T01', 'T04', 'T05', 'T06', 'T09']
TAG_FORMAT = "{:<5}"
# Inspired by https://github.com/reorx/httpstat
TEMPLATE = """
Total time cost: {total}(ms)
==============================================================================>
       |Monitor|Inspector           |Controller|Notifier|Evaluator           |
       |{M00}  |{M01}               |{M02}     |{M03}   |{M04}               |
       |       |      |      |      |          |        |      |      |      |
link down:{T00}|      |      |      |          |        |      |      |      |
     raw failure:{T01}|      |      |          |        |      |      |      |
         found affected:{T02}|      |          |        |      |      |      |
                  set VM error:{T03}|          |        |      |      |      |
                         marked host down:{T04}|        |      |      |      |
                               notified VM error:{T05}  |      |      |      |
                                        transformed event:{T06}|      |      |
                                                 evaluated event:{T07}|      |
                                                            fired alarm:{T08}|
                                                                received alarm:{T09}
"""


def main():
    check_points = ["T{:02d}".format(i) for i in range(TOTAL_CHECK_POINTS)]
    module_map = {"M{:02d}".format(i):
                  (MODULE_CHECK_POINTS[i], MODULE_CHECK_POINTS[i + 1])
                  for i in range(len(MODULE_CHECK_POINTS) - 1)}

    # check point tags
    elapsed_ms = {cp: os.getenv("{}_{}".format(PREFIX, cp))
                  for cp in check_points}

    def format_tag(tag):
        return TAG_FORMAT.format(tag or '?')

    tags = {cp: format_tag(ms) for cp, ms in elapsed_ms.iteritems()}

    def time_cost(cp):
        if elapsed_ms[cp[0]] and elapsed_ms[cp[1]]:
            return int(elapsed_ms[cp[1]]) - int(elapsed_ms[cp[0]])
        else:
            return None

    # module time cost tags
    modules_cost_ms = {module: time_cost(cp)
                       for module, cp in module_map.iteritems()}

    tags.update({module: format_tag(cost)
                 for module, cost in modules_cost_ms.iteritems()})

    tags.update({'total': time_cost((check_points[0], check_points[-1]))})

    profile = TEMPLATE.format(**tags)

    logfile = open('{}.json'.format(OUTPUT), 'w')
    logfile.write(json.dumps(tags))

    print profile

if __name__ == '__main__':
    main()