MCPcopy Create free account
hub / github.com/ARM-software/astc-encoder / progress_emitter

Function progress_emitter

Source/astcenccli_toplevel.cpp:185–209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

183 * @brief Callback emitting a progress bar
184 */
185extern "C" void progress_emitter(
186 float value
187) {
188 const unsigned int bar_size = 25;
189 unsigned int parts = static_cast<int>(value / 4.0f);
190
191 char buffer[bar_size + 3];
192 buffer[0] = '[';
193
194 for (unsigned int i = 0; i < parts; i++)
195 {
196 buffer[i + 1] = '=';
197 }
198
199 for (unsigned int i = parts; i < bar_size; i++)
200 {
201 buffer[i + 1] = ' ';
202 }
203
204 buffer[bar_size + 1] = ']';
205 buffer[bar_size + 2] = '\0';
206
207 printf(" Progress: %s %03.1f%%\r", buffer, static_cast<double>(value));
208 fflush(stdout);
209}
210
211/**
212 * @brief Test if a string argument is a well formed float.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected