API Design Review

Purpose of Code Review

Scope of Code Review

Code Review

Format

Tone

Starting Points

SOLID

Single responsibility principle

Open–closed principle

Liskov substitution principle

Interface segregation principle

Dependency inversion principle

ISO 25010: Software Product Quality

Functional Suitability

This characteristic represents the degree to which a product or system provides functions that meet stated and implied needs when used under specified conditions.

Performance Efficiency

This characteristic represents the performance relative to the amount of resources used under stated conditions.

ISO 25010: Software Product Quality II

Compatibility

Degree to which a product, system or component can exchange information with other products, systems or components, and/or perform its required functions, while sharing the same hardware or software environment.

Usability

Degree to which a product or system can be used by specified users to achieve specified goals with effectiveness, efficiency and satisfaction in a specified context of use.

ISO 25010: Software Product Quality III

Reliability

Degree to which a system, product or component performs specified functions under specified conditions for a specified period of time.

Security

Degree to which a product or system protects information and data so that persons or other products or systems have the degree of data access appropriate to their types and levels of authorization.

ISO 25010: Software Product Quality IV

Maintainability

This characteristic represents the degree of effectiveness and efficiency with which a product or system can be modified to improve it, correct it or adapt it to changes in environment, and in requirements.

Portability

Degree of effectiveness and efficiency with which a system, product or component can be transferred from one hardware, software or other operational or usage environment to another.

Review - task #2

Repository to review is in GitLab: project group task-2, project name <your-id>-api-review.

Submission format

Put everything in REVIEW.md file in root directory of the repository.

Comments to source code etc. paste as diffs (for example) into this file.

Parts of review

  1. basic health check
    • public classes
    • example
  2. another example: your implementation
    • reasonable code snippet
  3. actual review: your comments
    • full sentences, several paragraphs

Review: write numactl

numactl is GNU/Linux program for starting programs bound to one/several NUMA nodes. It can also print hardware configuration of the machine.

Task: write argument-parsing part of the program using the provided library.

Paste the source code into your REVIEW.md file.

Review: write numactl II

numactl can be started in the following ways:

numactl
numactl --hardware|-H
numactl --show|-s
numactl [policy-configuration-for-command] command args ...

Review: numactl

Should print help for all commands. Something along these lines:

usage: numactl [--interleave= | -i <nodes>] [--preferred= | -p <node>]
               [--physcpubind= | -C <cpus>] [--membind= | -m <nodes>] 
               command args ...
       numactl [--show | -s]
       numactl [--hardware | -H]

<nodes> is a comma delimited list of node numbers or A-B ranges or all.
<cpus> is a comma delimited list of cpu numbers or A-B ranges or all.

--interleave, -i   Interleave memory allocation across given nodes.
--preferred, -p    Prefer memory allocations from given node.
--membind, -m      Allocate memory from given nodes only.
--physcpubind, -C  Run on given CPUs only.
--show, -S         Show current NUMA policy.
--hardware, -H     Print hardware configuration.

Review: numactl --hardware

Prints hardware configuration in the following format.

available: 2 nodes (0-1)
node 0 cpus: 0 2 4 6 8 10 12 14 16 18 20 22
node 0 size: 24189 MB
node 0 free: 18796 MB
node 1 cpus: 1 3 5 7 9 11 13 15 17 19 21 23
node 1 size: 24088 MB
node 1 free: 16810 MB
node distances:
node   0   1 
  0:  10  20 
  1:  20  10 

Review: numactl --show

Print current configuration (policy).

policy: default
preferred node: current
physcpubind: 0 1 2 3 4 5 6 7 8 
cpubind: 0 1
nodebind: 0 1 
membind: 0 1 

Review: numactl [...] command args ...

Runs given program with changed NUMA policy.

Your demo has to accept the following options and instead of running the program print the final policy.

List specification

Note that -C, -m, -i are actually arrays of integers that are created from either of the following forms.

Review: numactl

Expected skeleton of your program is:

args = ... // configure the arguments
args.parse(argv)
if args.has("--show"):
   printf("policy: default"); print("...")
elif args.has("--hardware"):
   printf("available: 2 nodes (0-1)"); print("...")
elif:
   printf("will run %s", args.get_command())
   printf("CPU node bind: %s", args.get("-C").join(","))
   ...

Review: Your Comments

Review: Checklist

Source code documentation

Code style (formatting)

Review: Checklist

Option specification

Parameter extraction & co.

Documentation

Review: Your REVIEW.md File

Place it in the root directory of the repository.

Contents