-
Notifications
You must be signed in to change notification settings - Fork 65
Remove GLib dependency within bin/ #184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from 12 commits
1155efd
bec3b4e
b8b2895
41662dc
f9d1c49
6177f2d
f7d58de
88b7048
2a9dde1
9cf2913
7e7c41d
af3ff57
61fb3cd
f360f63
5f292f4
5ebea84
805efbb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,8 @@ | |
#include <assert.h> | ||
#include <string.h> | ||
|
||
#include "../include/libCacheSim/hashmap.h" | ||
#include "../include/libCacheSim/hashmap_defs.in" | ||
#include "../include/libCacheSim/reader.h" | ||
#include "../utils/include/mystr.h" | ||
|
||
|
@@ -242,7 +244,12 @@ void cal_working_set_size(reader_t *reader, int64_t *wss_obj, | |
int64_t *wss_byte) { | ||
reset_reader(reader); | ||
request_t *req = new_request(); | ||
GHashTable *obj_table = g_hash_table_new(g_direct_hash, g_direct_equal); | ||
hashmap_create_options_t obj_table_create_options = { | ||
.initial_capacity = 16, | ||
.comparer = obj_id_comparer, | ||
.hasher = obj_id_hasher}; | ||
struct hashmap_s new_obj_table; | ||
hashmap_create_ex(obj_table_create_options, &new_obj_table); | ||
*wss_obj = 0; | ||
*wss_byte = 0; | ||
|
||
|
@@ -267,11 +274,12 @@ void cal_working_set_size(reader_t *reader, int64_t *wss_obj, | |
continue; | ||
} | ||
|
||
if (g_hash_table_contains(obj_table, (gconstpointer)req->obj_id)) { | ||
if (hashmap_get(&new_obj_table, (const void *)(req->obj_id), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we just use obj_id as the key? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, it is done as so. There is a custom hasher for |
||
sizeof(obj_id_t)) != NULL) { | ||
continue; | ||
} | ||
|
||
g_hash_table_add(obj_table, (gpointer)req->obj_id); | ||
hashmap_put(&new_obj_table, (void *)(req->obj_id), sizeof(obj_id_t), req); | ||
|
||
*wss_obj += 1; | ||
*wss_byte += req->obj_size; | ||
|
@@ -289,7 +297,7 @@ void cal_working_set_size(reader_t *reader, int64_t *wss_obj, | |
(long long)*wss_byte); | ||
} | ||
|
||
g_hash_table_destroy(obj_table); | ||
hashmap_destroy(&new_obj_table); | ||
free_request(req); | ||
reset_reader(reader); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add some documentation on how to use the data structures in the repo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually
hashmap.h
is well documented. I shall then add code documentation and brief README for threadpool.h