0

How can I estimate the LOC of a linux component? In this case I would compare the LOC number that implement namespaces with the number of LOC which implement BPF.

3
  • 1
    You'd have to figure out to which "component" different files belong. And that won't be enough, because many files are going to contain lines that pertain to namespaces or BPF without being only about one or the other. You can see an example of how I did this for BPF, by counting only entire files: pchaigno.github.io/bpf/2019/07/02/bpf-verifier-complexity.html. Commented Dec 2, 2019 at 11:41
  • Do you think is it right to assume that namespaces implementation requires a greater number of LOC compared with bpf? Commented Dec 2, 2019 at 11:46
  • I don't know... Commented Dec 2, 2019 at 12:34

1 Answer 1

1

Some components are well delineated; BPF is one of these, largely contained in kernel/bpf/. Others aren’t, such as namespaces.

The best way to determine where a feature is implemented is to look for its Kconfig option:

git grep CONFIG_BPF\\b

will find everything involved in BPF, and

git grep -E 'CONFIG_(UTS|IPC|USER|PID|NET)_NS\b'

will find everything involved in namespaces (see init/Kconfig).

At this point, you can try to figure out how much code these configuration options control. I would disable everything, then enable everything you need to get a specific feature, but not the feature itself, then pre-process all the code. Once that’s done, enable the feature, and pre-process all the code again, and measure the difference...

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.