File export-to-postgresql.py
has 815 lines of code (exceeds 250 allowed). Consider refactoring. Open
# export-to-postgresql.py: export perf data to a postgresql database
# Copyright (c) 2014, Intel Corporation.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General Public License,
Function sample_table
has 26 arguments (exceeds 4 allowed). Consider refactoring. Open
def sample_table(sample_id, evsel_id, machine_id, thread_id, comm_id, dso_id, symbol_id, sym_offset, ip, time, cpu, to_dso_id, to_symbol_id, to_sym_offset, to_ip, period, weight, transaction, data_src, branch_type, in_tx, call_path_id, insn_cnt, cyc_cnt, flags, *x):
Function trace_end
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
def trace_end():
printdate("Copying to database...")
copy_output_file(evsel_file, "selected_events")
copy_output_file(machine_file, "machines")
copy_output_file(thread_file, "threads")
Function trace_end
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def trace_end():
printdate("Copying to database...")
copy_output_file(evsel_file, "selected_events")
copy_output_file(machine_file, "machines")
copy_output_file(thread_file, "threads")
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function call_return_table
has 15 arguments (exceeds 4 allowed). Consider refactoring. Open
def call_return_table(cr_id, thread_id, comm_id, call_path_id, call_time, return_time, branch_count, call_id, return_id, parent_call_path_id, flags, parent_id, insn_cnt, cyc_cnt, *x):
Function context_switch_table
has 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def context_switch_table(id, machine_id, time, cpu, thread_out_id, comm_out_id, thread_in_id, comm_in_id, flags, *x):
Function symbol_table
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def symbol_table(symbol_id, dso_id, sym_start, sym_end, binding, symbol_name, *x):
Function dso_table
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def dso_table(dso_id, machine_id, short_name, long_name, build_id, *x):
Function comm_table
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def comm_table(comm_id, comm_str, thread_id, time, exec_flag, *x):
Function thread_table
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def thread_table(thread_id, machine_id, process_id, pid, tid, *x):
Function call_path_table
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def call_path_table(cp_id, parent_id, symbol_id, ip, *x):
Function synth_data
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def synth_data(id, config, raw_buf, *x):
if config == 0:
ptwrite(id, raw_buf)
elif config == 1:
mwait(id, raw_buf)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function copy_output_file
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def copy_output_file(file, table_name):
conn = PQconnectdb(toclientstr("dbname = " + dbname))
if (PQstatus(conn)):
raise Exception("COPY FROM STDIN PQconnectdb failed")
file.write(file_trailer)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"