<commit_before>import commands

class HeavyProcessStat(object):
    def __init__(self,options=None):
        if not options: options = {}

        if "proc_number" in options:
            self.howMany = int(options["proc_number"])
        else:
            self.howMany = 5

    def report(self):
        howMany = self.howMany
        proc = {}
        out = commands.getoutput("ps xrco %cpu,command") # -o for custom format, -r for cpu sorting, -c for just process name (not full path, -x for all processes)
        for line in out.split("\n")[1:]: #ommiting shit
            s = line.split(" ", 3) # btw how to not pass a separator (use default separator == any whitespace) and split with max split? Any ideas? "\s" separator doesn't seem to work
            if proc.has_key(s[3]): # this is nessesary since we can have processes with not unique name like "Google Chrome"
                proc[s[3]] += float(s[2])
            else:
                proc[s[3]] = float(s[2])
                howMany -= 1

            if howMany == 0: # means we already gathered top 5 proceses with unique name!
                break

        return proc



<commit_msg>Heavy process patch applied, Fuck! its working!<commit_after>import commands

class HeavyProcessStat(object):
    def __init__(self,options=None):
        if not options: options = {}

        if "proc_number" in options:
            self.howMany = int(options["proc_number"])
        else:
            self.howMany = 5

    def report(self):
        howMany = self.howMany
        proc = {}
        out = commands.getoutput("ps xrco %cpu,command") # -o for custom format, -r for cpu sorting, -c for just process name (not full path, -x for all processes)
        for line in out.split("\n")[1:]: #ommiting shit
            s = line.split(None, 1) # btw how to not pass a separator (use default separator == any whitespace) and split with max split? Any ideas? "\s" separator doesn't seem to work
            if proc.has_key(s[1]): # this is nessesary since we can have processes with not unique name like "Google Chrome"
                proc[s[1]] += float(s[0])
            else:
                proc[s[1]] = float(s[0])
                howMany -= 1

            if howMany == 0: # means we already gathered top 5 proceses with unique name!
                break

        return proc




{'fraction_non_alphanumeric': 0.10285958173282117, 'fraction_numerical': 0.009389671361502348, 'mean_word_length': 2.1336898395721926, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3933020', 'n_tokens_mistral': 690, 'n_tokens_neox': 644, 'n_words': 250}