Add C bindings for LowerThreadPoolIO/CPUPriority (#5285)

Summary:
There were no C bindings for lowering thread pool priority. This adds those.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/5285

Differential Revision: D15290050

Pulled By: siying

fbshipit-source-id: b2ed94d0c39d27434ace2204829a242b53d0d67a
This commit is contained in:
Jelte Fennema 2019-05-09 18:16:45 -07:00 committed by Facebook Github Bot
parent 9fad3e21eb
commit 6451673f37
2 changed files with 21 additions and 0 deletions

16
db/c.cc
View File

@ -3268,6 +3268,22 @@ void rocksdb_env_join_all_threads(rocksdb_env_t* env) {
env->rep->WaitForJoin(); env->rep->WaitForJoin();
} }
void rocksdb_env_lower_thread_pool_io_priority(rocksdb_env_t* env) {
env->rep->LowerThreadPoolIOPriority();
}
void rocksdb_env_lower_high_priority_thread_pool_io_priority(rocksdb_env_t* env) {
env->rep->LowerThreadPoolIOPriority(Env::HIGH);
}
void rocksdb_env_lower_thread_pool_cpu_priority(rocksdb_env_t* env) {
env->rep->LowerThreadPoolCPUPriority();
}
void rocksdb_env_lower_high_priority_thread_pool_cpu_priority(rocksdb_env_t* env) {
env->rep->LowerThreadPoolCPUPriority(Env::HIGH);
}
void rocksdb_env_destroy(rocksdb_env_t* env) { void rocksdb_env_destroy(rocksdb_env_t* env) {
if (!env->is_default) delete env->rep; if (!env->is_default) delete env->rep;
delete env; delete env;

View File

@ -1301,6 +1301,11 @@ extern ROCKSDB_LIBRARY_API void
rocksdb_env_set_high_priority_background_threads(rocksdb_env_t* env, int n); rocksdb_env_set_high_priority_background_threads(rocksdb_env_t* env, int n);
extern ROCKSDB_LIBRARY_API void rocksdb_env_join_all_threads( extern ROCKSDB_LIBRARY_API void rocksdb_env_join_all_threads(
rocksdb_env_t* env); rocksdb_env_t* env);
extern ROCKSDB_LIBRARY_API void rocksdb_env_lower_thread_pool_io_priority(rocksdb_env_t* env);
extern ROCKSDB_LIBRARY_API void rocksdb_env_lower_high_priority_thread_pool_io_priority(rocksdb_env_t* env);
extern ROCKSDB_LIBRARY_API void rocksdb_env_lower_thread_pool_cpu_priority(rocksdb_env_t* env);
extern ROCKSDB_LIBRARY_API void rocksdb_env_lower_high_priority_thread_pool_cpu_priority(rocksdb_env_t* env);
extern ROCKSDB_LIBRARY_API void rocksdb_env_destroy(rocksdb_env_t*); extern ROCKSDB_LIBRARY_API void rocksdb_env_destroy(rocksdb_env_t*);
extern ROCKSDB_LIBRARY_API rocksdb_envoptions_t* rocksdb_envoptions_create(); extern ROCKSDB_LIBRARY_API rocksdb_envoptions_t* rocksdb_envoptions_create();