MCPcopy Create free account
hub / github.com/appdevforall/CodeOnTheGo / set_process_priority

Function set_process_priority

subprojects/llama.cpp/common/common.cpp:214–234  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

212#if defined(_WIN32)
213
214bool set_process_priority(enum ggml_sched_priority prio) {
215 if (prio == GGML_SCHED_PRIO_NORMAL) {
216 return true;
217 }
218
219 DWORD p = NORMAL_PRIORITY_CLASS;
220 switch (prio) {
221 case GGML_SCHED_PRIO_LOW: p = BELOW_NORMAL_PRIORITY_CLASS; break;
222 case GGML_SCHED_PRIO_NORMAL: p = NORMAL_PRIORITY_CLASS; break;
223 case GGML_SCHED_PRIO_MEDIUM: p = ABOVE_NORMAL_PRIORITY_CLASS; break;
224 case GGML_SCHED_PRIO_HIGH: p = HIGH_PRIORITY_CLASS; break;
225 case GGML_SCHED_PRIO_REALTIME: p = REALTIME_PRIORITY_CLASS; break;
226 }
227
228 if (!SetPriorityClass(GetCurrentProcess(), p)) {
229 LOG_WRN("failed to set process priority class %d : (%d)\n", prio, (int) GetLastError());
230 return false;
231 }
232
233 return true;
234}
235
236#else // MacOS and POSIX
237#include <sys/types.h>

Callers 2

mainFunction · 0.85
mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected