EECE 276 – Embedded Systems1EECE 276Embedded SystemsPerformance calculations and improvementsEECE 276 – Embedded Systems2I/O PerformanceO Key contributor to performance in manyembedded systems: I/O» Disk I/O» Network I/O» External events I/O (e.g. radar tracks)O Compute-bound vs. I/O bound systems» Bottleneck in computation or in I/O?EECE 276 – Embedded Systems3I/O PerformanceO Basic buffer size calculation:» Production rate = P(t), consumption rate = C(t) (packets/sec)» If C >= P then no buffer is needed.» If C <= P for a (burst) period of time T, thenB = (P-C) * TNOTE: This works only if the buffer can be emptied before the next burst.O Variable buffer-size calculation:Burst period T = t2 – t1∫−=212)]()([)(ttdttctptBEECE 276 – Embedded Systems4I/O PerformanceO Example:p(t) = 10,000t 0<= t <= 110,000(2-t) 1 < t <= 20 elsewherec(t) = 10,000(1/4)t 0<= t <= 210,000(1-1/4t) 2 < t <= 40 elsewhereIf burst period T = [0..1.6] seconds, then B(1.6) yields ~ 600 bytes(Compute integral for 0..1 and 1..1.6, etc.)O If the burst period is determined by u(t) (i.e. a real valued function), compute integral from t1 to u(t1).EECE 276 – Embedded Systems5Performance optimizationO Compute at the slowest rate (that is still acceptable)O Use fixed-point numbers instead of floating point» Scaled integers: shift radix pointO Use lookup tables with interpolation for functions (instead of complex code)O Allow imprecise computations (e.g. fewer samples, larger errors, etc.) if needed to trade for time.EECE 276 – Embedded Systems6Compiler optimization techniquesO Common sub-expression eliminationO Intrinsic functions » Macros, inlinesO Constant folding » Compact constant opsO Loop invariants » Expressions in loops that don’t changeO Loop induction elimination » Value of loop variable changes systematicallyO Use registers or caches » Move code into cache, size data s.t. it fits cacheEECE 276 – Embedded Systems7Compiler optimization techniquesO Eliminate dead/unreachable codeO Control flow optimization » Fewer branchesO Constant propagation » Variable set to constant and then usedO Dead variable elimination » Variable’s value is discardedO Short-circuiting boolean code » if (aa && bb) ..O Loop unrolling » Expand/replicate loop codeO Loop jamming» Integrate similar, neighboring loopsO Cross-jump elimination» Same code in multiple switch
View Full Document