i915.ko authors, by the numbers

Because of some event I cannot remember, I was curious to see which developers had how many lines of code. It turned out to be more of a challenge than I thought (mostly because of Unicode). Here is the top 10 from the very latest drm-intel-nightly.

>./count_i915.py drivers/gpu/drm/i915/

total lines counted: 67417 (compare with git ls-files — ./drivers/gpu/drm/i915/ | xargs wc -l)
[(‘Jesse Barnes’, 16255),
(‘Chris Wilson’, 13174),
(‘Daniel Vetter’, 11066),
(‘Eugeni Dodonov’, 3636),
(‘Paulo Zanoni’, 3434),
(‘Ben Widawsky’, 2935),
(‘Eric Anholt’, 2176),
(‘Keith Packard’, 1773),
(‘Zhenyu Wang’, 1703),
(‘Ville Syrjälä’, 1130)]

 

And here is the slightly better than one-off script I used:

#!/usr/bin/env python3
import sys
import os
import subprocess
import re
import collections
import pprint

count = collections.Counter()
p = re.compile(r'.+ \(([\w\W]+) [0-9]{4}-[0-9]{2}-[0-9]{2}.*', re.UNICODE)

path=sys.argv[1]
git_path=os.path.dirname(sys.argv[0]) + "/" + path
os.chdir(git_path)
for file in os.listdir(os.getcwd()):
        blame = subprocess.check_output(["git", "blame", "-w", "--abbrev=10", file],
                        stderr=subprocess.STDOUT)
        for line in blame.splitlines():
                m = p.match(str(line, 'utf-8'))
                name = str(m.group(1))
                name = name.rstrip()
                count[name] += 1

print("total lines counted: " + str(sum(count.values())) + " (compare with git ls-files -- " + git_path + " | xargs wc -l)")
pprint.pprint(count.most_common(10))

EDIT: The code pretty printer doesn’t like ” and therefore 3 instances were missing in the first post. I’ve actually copy/pasted the version from the blog now and run it.

Download PDF
Posted in Uncategorized

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.