ofp 547 tools/perf/util/scripting-engines/trace-event-perl.c FILE *ofp; ofp 550 tools/perf/util/scripting-engines/trace-event-perl.c ofp = fopen(fname, "w"); ofp 551 tools/perf/util/scripting-engines/trace-event-perl.c if (ofp == NULL) { ofp 556 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, "# perf script event handlers, " ofp 559 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, "# Licensed under the terms of the GNU GPL" ofp 562 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, "# The common_* event handler fields are the most useful " ofp 565 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, "# all events. They don't necessarily correspond to " ofp 568 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, "# in the format files. Those fields not available as " ofp 571 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, "# be retrieved using Perl functions of the form " ofp 574 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, "# See Context.pm for the list of available " ofp 577 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, "use lib \"$ENV{'PERF_EXEC_PATH'}/scripts/perl/" ofp 580 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, "use lib \"./Perf-Trace-Util/lib\";\n"); ofp 581 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, "use Perf::Trace::Core;\n"); ofp 582 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, "use Perf::Trace::Context;\n"); ofp 583 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, "use Perf::Trace::Util;\n\n"); ofp 585 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, "sub trace_begin\n{\n\t# optional\n}\n\n"); ofp 586 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, "sub trace_end\n{\n\t# optional\n}\n"); ofp 589 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, "\n\ ofp 612 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, "sub %s::%s\n{\n", event->system, event->name); ofp 613 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, "\tmy ("); ofp 615 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, "$event_name, "); ofp 616 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, "$context, "); ofp 617 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, "$common_cpu, "); ofp 618 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, "$common_secs, "); ofp 619 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, "$common_nsecs,\n"); ofp 620 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, "\t $common_pid, "); ofp 621 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, "$common_comm, "); ofp 622 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, "$common_callchain,\n\t "); ofp 629 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, ", "); ofp 631 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, "\n\t "); ofp 633 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, "$%s", f->name); ofp 635 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, ") = @_;\n\n"); ofp 637 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, "\tprint_header($event_name, $common_cpu, " ofp 641 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, "\tprintf(\""); ofp 648 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, ", "); ofp 650 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, "\".\n\t \""); ofp 654 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, "%s=", f->name); ofp 658 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, "%%s"); ofp 660 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, "%%d"); ofp 662 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, "%%u"); ofp 665 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, "\\n\",\n\t "); ofp 672 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, ", "); ofp 675 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, "\n\t "); ofp 679 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, "\n\t "); ofp 682 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, "flag_str(\""); ofp 683 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, "%s::%s\", ", event->system, ofp 685 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, "\"%s\", $%s)", f->name, ofp 689 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, "\n\t "); ofp 692 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, "symbol_str(\""); ofp 693 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, "%s::%s\", ", event->system, ofp 695 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, "\"%s\", $%s)", f->name, ofp 698 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, "$%s", f->name); ofp 701 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, ");\n\n"); ofp 703 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, "\tprint_backtrace($common_callchain);\n"); ofp 705 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, "}\n\n"); ofp 708 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, "sub trace_unhandled\n{\n\tmy ($event_name, $context, " ofp 712 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, "\tprint_header($event_name, $common_cpu, " ofp 715 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, "\tprint_backtrace($common_callchain);\n"); ofp 716 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, "}\n\n"); ofp 718 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, "sub print_header\n{\n" ofp 723 tools/perf/util/scripting-engines/trace-event-perl.c fprintf(ofp, ofp 744 tools/perf/util/scripting-engines/trace-event-perl.c fclose(ofp); ofp 1695 tools/perf/util/scripting-engines/trace-event-python.c FILE *ofp; ofp 1698 tools/perf/util/scripting-engines/trace-event-python.c ofp = fopen(fname, "w"); ofp 1699 tools/perf/util/scripting-engines/trace-event-python.c if (ofp == NULL) { ofp 1703 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "# perf script event handlers, " ofp 1706 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "# Licensed under the terms of the GNU GPL" ofp 1709 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "# The common_* event handler fields are the most useful " ofp 1712 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "# all events. They don't necessarily correspond to " ofp 1715 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "# in the format files. Those fields not available as " ofp 1718 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "# be retrieved using Python functions of the form " ofp 1721 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "# See the perf-script-python Documentation for the list " ofp 1724 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "from __future__ import print_function\n\n"); ofp 1725 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "import os\n"); ofp 1726 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "import sys\n\n"); ofp 1728 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "sys.path.append(os.environ['PERF_EXEC_PATH'] + \\\n"); ofp 1729 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "\t'/scripts/python/Perf-Trace-Util/lib/Perf/Trace')\n"); ofp 1730 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "\nfrom perf_trace_context import *\n"); ofp 1731 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "from Core import *\n\n\n"); ofp 1733 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "def trace_begin():\n"); ofp 1734 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "\tprint(\"in trace_begin\")\n\n"); ofp 1736 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "def trace_end():\n"); ofp 1737 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "\tprint(\"in trace_end\")\n\n"); ofp 1744 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "def %s__%s(", event->system, event->name); ofp 1745 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "event_name, "); ofp 1746 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "context, "); ofp 1747 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "common_cpu,\n"); ofp 1748 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "\tcommon_secs, "); ofp 1749 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "common_nsecs, "); ofp 1750 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "common_pid, "); ofp 1751 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "common_comm,\n\t"); ofp 1752 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "common_callchain, "); ofp 1759 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, ", "); ofp 1761 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "\n\t"); ofp 1763 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "%s", f->name); ofp 1766 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, ", "); ofp 1768 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "\n\t\t"); ofp 1769 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "perf_sample_dict"); ofp 1771 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "):\n"); ofp 1773 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "\t\tprint_header(event_name, common_cpu, " ofp 1777 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "\t\tprint(\""); ofp 1784 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, ", "); ofp 1786 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "\" \\\n\t\t\""); ofp 1790 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "%s=", f->name); ofp 1795 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "%%s"); ofp 1797 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "%%d"); ofp 1799 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "%%u"); ofp 1802 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "\" %% \\\n\t\t("); ofp 1809 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, ", "); ofp 1812 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "\n\t\t"); ofp 1816 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "\n\t\t"); ofp 1819 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "flag_str(\""); ofp 1820 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "%s__%s\", ", event->system, ofp 1822 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "\"%s\", %s)", f->name, ofp 1826 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "\n\t\t"); ofp 1829 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "symbol_str(\""); ofp 1830 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "%s__%s\", ", event->system, ofp 1832 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "\"%s\", %s)", f->name, ofp 1835 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "%s", f->name); ofp 1838 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "))\n\n"); ofp 1840 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "\t\tprint('Sample: {'+" ofp 1843 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "\t\tfor node in common_callchain:"); ofp 1844 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "\n\t\t\tif 'sym' in node:"); ofp 1845 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "\n\t\t\t\tprint(\"\\t[%%x] %%s\" %% (node['ip'], node['sym']['name']))"); ofp 1846 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "\n\t\t\telse:"); ofp 1847 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "\n\t\t\t\tprint(\"\t[%%x]\" %% (node['ip']))\n\n"); ofp 1848 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "\t\tprint()\n\n"); ofp 1852 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "def trace_unhandled(event_name, context, " ofp 1855 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "\t\tprint(get_dict_as_string(event_fields_dict))\n"); ofp 1856 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "\t\tprint('Sample: {'+" ofp 1859 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "def print_header(" ofp 1864 tools/perf/util/scripting-engines/trace-event-python.c fprintf(ofp, "def get_dict_as_string(a_dict, delimiter=' '):\n" ofp 1868 tools/perf/util/scripting-engines/trace-event-python.c fclose(ofp);