Git cpp bash
Jump to navigation
Jump to search
GIT
- Save work progress in a repository
- For example github.com
- Use branches
- one for implementing bash script and another for c++
- commit often,
- when checking out a random revision, it should compile.
- for example first commit might be a simple "hello world".
- finished work should be merged into master
BASH
- awk
- grep
- sed
Script 1
Script has 1 optional argument, path to meminfo file. If it's not provided use "/proc/meminfo"
Use standard unix tools like awk, grep, sed and others
output: RAM: x MB used / y MB total ( z MB free)
Example of /proc/meminfo
cat /proc/meminfo MemTotal: 7969612 kB MemFree: 4582768 kB Buffers: 707368 kB Cached: 1122984 kB SwapCached: 0 kB Active: 1742408 kB Inactive: 1203472 kB Active(anon): 1115268 kB Inactive(anon): 168692 kB Active(file): 627140 kB Inactive(file): 1034780 kB Unevictable: 0 kB Mlocked: 0 kB SwapTotal: 0 kB SwapFree: 0 kB Dirty: 148 kB Writeback: 0 kB AnonPages: 1115604 kB Mapped: 251420 kB Shmem: 168440 kB Slab: 288752 kB SReclaimable: 256656 kB SUnreclaim: 32096 kB KernelStack: 3784 kB PageTables: 36524 kB NFS_Unstable: 0 kB Bounce: 0 kB WritebackTmp: 0 kB CommitLimit: 3984804 kB Committed_AS: 3669332 kB VmallocTotal: 34359738367 kB VmallocUsed: 563420 kB VmallocChunk: 34359156568 kB HardwareCorrupted: 0 kB AnonHugePages: 0 kB HugePages_Total: 0 HugePages_Free: 0 HugePages_Rsvd: 0 HugePages_Surp: 0 Hugepagesize: 2048 kB DirectMap4k: 59392 kB DirectMap2M: 8189952 kB
Script 2
Compiles the C++ application Probably only has 1 useful line, g++ with some linker options.
C++
- boost
- datetime
- format
- filesystem (3)
Application
Program takes one argument: path to directory.
Application must print out the name of directory. List all files in that directory. Each line must be preceded with the current running time of application. At the end, show total run time.
Use boost libraries: format, datetime, filesystem.
Output format:
List of files in '/path/to/directory' Time: 00:00:00.123456 file: 'filename1' Time: 00:00:01.123456 file: 'filename1' Time: 00:00:02.123456 file: 'filename1' Total running time was: 00:00:10.654321