torvalds/linux

View on GitHub
tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py

Summary

Maintainability
F
1 wk
Test Coverage

File intel_pstate_tracer.py has 476 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0-only
# -*- coding: utf-8 -*-
#
""" This utility can be used to debug and tune the performance of the
Severity: Minor
Found in tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py - About 7 hrs to fix

    Function read_trace_data has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

    def read_trace_data(filename, cpu_mask):
        """ Read and parse trace data """
    
        global current_max_cpu
        global sample_num, last_sec_cpu, last_usec_cpu, start_time
    Severity: Minor
    Found in tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py - About 2 hrs to fix

    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 store_csv has 19 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def store_csv(cpu_int, time_pre_dec, time_post_dec, core_busy, scaled, _from, _to, mperf, aperf, tsc, freq_ghz, io_boost, common_comm, load, duration_ms, sample_num, elapsed_time, tsc_ghz, cpu_mask):
    Severity: Major
    Found in tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py - About 2 hrs to fix

      Function split_csv has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      def split_csv(current_max_cpu, cpu_mask):
          """ seperate the all csv file into per CPU csv files. """
      
          if os.path.exists('cpu.csv'):
              for index in range(0, current_max_cpu + 1):
      Severity: Minor
      Found in tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py - About 25 mins to fix

      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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

              if opt == '-h':
                  print_help('intel_pstate')
                  sys.exit()
              elif opt in ("-t", "--trace_file"):
                  valid1 = True
      Severity: Major
      Found in tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py and 1 other location - About 1 day to fix
      tools/power/x86/amd_pstate_tracer/amd_pstate_trace.py on lines 272..288

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 152.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      def plot_boost_cpu():
          """ Plot all cpu IO Boosts """
      
          output_png = 'all_cpu_boost.png'
          g_plot = common_all_gnuplot_settings(output_png)
      Severity: Major
      Found in tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py and 1 other location - About 7 hrs to fix
      tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py on lines 204..216

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 113.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      def plot_load_cpu():
          """ Plot all cpu loads """
      
          output_png = 'all_cpu_loads.png'
          g_plot = common_all_gnuplot_settings(output_png)
      Severity: Major
      Found in tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py and 1 other location - About 7 hrs to fix
      tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py on lines 260..272

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 113.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 5 locations. Consider refactoring.
      Open

      def plot_duration_cpu():
          """ Plot all cpu durations """
      
          output_png = 'all_cpu_durations.png'
          g_plot = common_all_gnuplot_settings(output_png)
      Severity: Major
      Found in tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py and 4 other locations - About 6 hrs to fix
      tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py on lines 187..202
      tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py on lines 218..230
      tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py on lines 246..258
      tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py on lines 274..286

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 106.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 5 locations. Consider refactoring.
      Open

      def plot_scaled_cpu():
          """ Plot all cpu scaled busy """
      
          output_png = 'all_cpu_scaled.png'
          g_plot = common_all_gnuplot_settings(output_png)
      Severity: Major
      Found in tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py and 4 other locations - About 6 hrs to fix
      tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py on lines 187..202
      tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py on lines 218..230
      tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py on lines 232..244
      tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py on lines 274..286

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 106.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 5 locations. Consider refactoring.
      Open

      def plot_ghz_cpu():
          """ Plot all cpu tsc ghz """
      
          output_png = 'all_cpu_ghz.png'
          g_plot = common_all_gnuplot_settings(output_png)
      Severity: Major
      Found in tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py and 4 other locations - About 6 hrs to fix
      tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py on lines 187..202
      tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py on lines 218..230
      tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py on lines 232..244
      tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py on lines 246..258

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 106.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 5 locations. Consider refactoring.
      Open

      def plot_frequency_cpu():
          """ Plot all cpu frequencies """
      
          output_png = 'all_cpu_frequencies.png'
          g_plot = common_all_gnuplot_settings(output_png)
      Severity: Major
      Found in tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py and 4 other locations - About 6 hrs to fix
      tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py on lines 187..202
      tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py on lines 232..244
      tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py on lines 246..258
      tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py on lines 274..286

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 106.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 5 locations. Consider refactoring.
      Open

      def plot_pstate_cpu():
          """ Plot all cpu information from csv files """
      
          output_png = 'all_cpu_pstates.png'
          g_plot = common_all_gnuplot_settings(output_png)
      Severity: Major
      Found in tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py and 4 other locations - About 6 hrs to fix
      tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py on lines 218..230
      tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py on lines 232..244
      tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py on lines 246..258
      tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py on lines 274..286

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 106.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

          if cpu_list:
              for p in re.split("[,]", cpu_list):
                  if int(p) < MAX_CPUS :
                      cpu_mask[int(p)] = 1
          else:
      Severity: Major
      Found in tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py and 1 other location - About 3 hrs to fix
      tools/power/x86/amd_pstate_tracer/amd_pstate_trace.py on lines 294..300

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 69.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      def cleanup_data_files():
          """ clean up existing data files """
      
          if os.path.exists('cpu.csv'):
              os.remove('cpu.csv')
      Severity: Major
      Found in tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py and 1 other location - About 3 hrs to fix
      tools/power/x86/amd_pstate_tracer/amd_pstate_trace.py on lines 175..183

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 63.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

                      duration_us = (int(time_pre_dec) - int(last_sec_cpu[cpu_int])) * 1000000 + (int(time_post_dec) - int(last_usec_cpu[cpu_int]))
      Severity: Major
      Found in tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py and 1 other location - About 2 hrs to fix
      tools/power/x86/amd_pstate_tracer/amd_pstate_trace.py on lines 227..227

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 57.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      def disable_trace(trace_file):
          """ Disable trace """
      
          try:
             open(trace_file, 'w').write("0")
      Severity: Major
      Found in tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py and 1 other location - About 1 hr to fix
      tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py on lines 382..389

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 40.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      def enable_trace(trace_file):
          """ Enable trace """
      
          try:
              open(trace_file,'w').write("1")
      Severity: Major
      Found in tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py and 1 other location - About 1 hr to fix
      tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py on lines 391..398

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 40.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

                  if sample_num == 0 :
                      start_time = Decimal(time_pre_dec) + Decimal(time_post_dec) / Decimal(1000000)
      Severity: Major
      Found in tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py and 1 other location - About 1 hr to fix
      tools/power/x86/amd_pstate_tracer/amd_pstate_trace.py on lines 219..220

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 39.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

                      elapsed_time = Decimal(time_pre_dec) + Decimal(time_post_dec) / Decimal(1000000) - start_time
      Severity: Minor
      Found in tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py and 1 other location - About 45 mins to fix
      tools/power/x86/amd_pstate_tracer/amd_pstate_trace.py on lines 231..231

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 35.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      There are no issues that match your filters.

      Category
      Status