Skip to content

Commit

Permalink
Remove unused set_cpu_affinity, cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: falkTX <[email protected]>
  • Loading branch information
falkTX committed Feb 3, 2024
1 parent 8905ca6 commit 99d9aa2
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 25 deletions.
9 changes: 0 additions & 9 deletions modtools/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,9 +616,6 @@ class JackData(Structure):
utils.file_uri_parse.argtypes = (c_char_p,)
utils.file_uri_parse.restype = c_char_p

utils.set_cpu_affinity.argtypes = (c_int,)
utils.set_cpu_affinity.restype = None

utils.init_jack.argtypes = None
utils.init_jack.restype = c_bool

Expand Down Expand Up @@ -918,12 +915,6 @@ def get_bundle_dirname(bundleuri):

return bundle

# ------------------------------------------------------------------------------------------------------------
# helper utilities

def set_cpu_affinity(cpu):
utils.set_cpu_affinity(cpu)

# ------------------------------------------------------------------------------------------------------------
# jack stuff

Expand Down
3 changes: 0 additions & 3 deletions utils/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -427,9 +427,6 @@ MOD_API const char* const* list_plugins_in_bundle(const char* bundle);
// Convert a file URI to a local path string.
MOD_API const char* file_uri_parse(const char* fileuri);

// helper utilities
MOD_API void set_cpu_affinity(int cpu);

// jack stuff
MOD_API bool init_jack(void);
MOD_API void close_jack(void);
Expand Down
15 changes: 2 additions & 13 deletions utils/utils_lilv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ inline bool contains(const std::unordered_map<std::string, T>& map, const std::s
return map.find(value) != map.end();
}

inline bool ends_with(const std::string& value, const std::string ending)
inline bool ends_with(const std::string& value, const std::string& ending)
{
if (ending.size() > value.size())
return false;
Expand All @@ -267,7 +267,7 @@ inline std::string sha1(const char* const cstring)

uint8_t* const hashenc = sha1_result(&s);
for (int i=0; i<HASH_LENGTH; i++) {
sprintf(hashdec+(i*2), "%02x", hashenc[i]);
snprintf(hashdec+(i*2), 3, "%02x", hashenc[i]);
}
hashdec[HASH_LENGTH*2] = '\0';

Expand Down Expand Up @@ -5957,15 +5957,4 @@ const char* file_uri_parse(const char* const fileuri)
return _file_uri_parse_ret != nullptr ? _file_uri_parse_ret : nc;
}

void set_cpu_affinity(const int cpu)
{
#ifdef __linux__
printf("NOTE: Running pinned to core #%d\n", cpu+1);
cpu_set_t cpuset;
CPU_ZERO(&cpuset);
CPU_SET(cpu, &cpuset);
sched_setaffinity(0, sizeof(cpuset), &cpuset);
#endif
}

// --------------------------------------------------------------------------------------------------------

0 comments on commit 99d9aa2

Please sign in to comment.