Many embedded systems require hard or soft realtime execution. To ensure the requirements are met, it is necessary to measure the execution time of individual tasks, as well as establish the overall real-time performance of the system. This paper presents a variety of techniques, at both coarse-grain and fine-grain levels, to measure execution time of both user code and operating system overhead. The measurements can then be used as the basis for accurate real-time scheduling analysis, for identifying timing problems, or to know what code needs to be optimized. The coarse-grain techniques are generally software-oriented and provide measurements with millisecond resolution. They are good for quick estimates of utilization. The fine-grain techniques are more elaborate and use specialized debugging hardware or logic analyzers, to provide microsecond resolution measurements. Creating measurable code, identifying timing errors, and filtering measurement data are also discussed.