summaryrefslogtreecommitdiff
path: root/src/analysis/disass
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2019-01-22 18:36:15 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2019-01-22 18:36:15 (GMT)
commitf251814cf0fd10a767972530c119f8f109613c48 (patch)
treee9bd67bca2531c083ee0754fe6dabe043c8012d1 /src/analysis/disass
parentc1bcf3e7bd0a256005bd15832117b78cee5fdfab (diff)
Fixed run sizes of parallel jobs.
Diffstat (limited to 'src/analysis/disass')
-rw-r--r--src/analysis/disass/area.c18
-rw-r--r--src/analysis/disass/disassembler.c10
2 files changed, 9 insertions, 19 deletions
diff --git a/src/analysis/disass/area.c b/src/analysis/disass/area.c
index 0a82b99..84bf8a4 100644
--- a/src/analysis/disass/area.c
+++ b/src/analysis/disass/area.c
@@ -1949,8 +1949,8 @@ mem_area *collect_memory_areas(wgroup_id_t gid, GtkStatusStack *status, GLoadedB
{
mem_area *result; /* Liste finale à retourner */
guint runs_count; /* Qté d'exécutions parallèles */
- GAreaCollector **collectors; /* Collecteurs à suivre */
phys_t run_size; /* Volume réparti par exécution*/
+ GAreaCollector **collectors; /* Collecteurs à suivre */
GWorkQueue *queue; /* Gestionnaire de différés */
activity_id_t id; /* Identifiant de progression */
GMutex *global; /* Atomicité sur zones multi. */
@@ -1967,12 +1967,10 @@ mem_area *collect_memory_areas(wgroup_id_t gid, GtkStatusStack *status, GLoadedB
/* Lancement des traitements */
- runs_count = get_max_online_threads();
+ run_size = compute_run_size(length, &runs_count);
collectors = (GAreaCollector **)calloc(runs_count, sizeof(GAreaCollector *));
- run_size = length / runs_count;
-
queue = get_work_queue();
id = gtk_status_stack_add_activity(status, _("Computing memory areas to disassemble"), length);
@@ -2133,8 +2131,8 @@ void populate_fresh_memory_areas(wgroup_id_t gid, GtkStatusStack *status, mem_ar
{
size_t icount; /* Quantité d'instructions */
guint runs_count; /* Qté d'exécutions parallèles */
- GAreaCollector **collectors; /* Collecteurs à suivre */
phys_t run_size; /* Volume réparti par exécution*/
+ GAreaCollector **collectors; /* Collecteurs à suivre */
GWorkQueue *queue; /* Gestionnaire de différés */
activity_id_t id; /* Identifiant de progression */
guint i; /* Boucle de parcours */
@@ -2145,12 +2143,10 @@ void populate_fresh_memory_areas(wgroup_id_t gid, GtkStatusStack *status, mem_ar
icount = _g_preload_info_count_instructions(info);
- runs_count = get_max_online_threads();
+ run_size = compute_run_size(icount, &runs_count);
collectors = (GAreaCollector **)calloc(runs_count, sizeof(GAreaCollector *));
- run_size = icount / runs_count;
-
queue = get_work_queue();
id = gtk_status_stack_add_activity(status, _("Inserting all preloaded instructions"), icount);
@@ -2410,8 +2406,8 @@ GArchInstruction **collect_disassembled_instructions(wgroup_id_t gid, GtkStatusS
GArchInstruction **result; /* Liste finale à retourner */
GMutex *global; /* Atomicité sur zones multi. */
guint runs_count; /* Qté d'exécutions parallèles */
- GAreaCollector **collectors; /* Collecteurs à suivre */
size_t run_size; /* Volume réparti par exécution*/
+ GAreaCollector **collectors; /* Collecteurs à suivre */
GWorkQueue *queue; /* Gestionnaire de différés */
activity_id_t id; /* Identifiant de progression */
guint i; /* Boucle de parcours */
@@ -2430,12 +2426,10 @@ GArchInstruction **collect_disassembled_instructions(wgroup_id_t gid, GtkStatusS
/* Lancement des traitements */
- runs_count = get_max_online_threads();
+ run_size = compute_run_size(acount, &runs_count);
collectors = (GAreaCollector **)calloc(runs_count, sizeof(GAreaCollector *));
- run_size = acount / runs_count;
-
queue = get_work_queue();
id = gtk_status_stack_add_activity(status, _("Collecting all disassembled instructions"), acount);
diff --git a/src/analysis/disass/disassembler.c b/src/analysis/disass/disassembler.c
index d73130c..e548fcd 100644
--- a/src/analysis/disass/disassembler.c
+++ b/src/analysis/disass/disassembler.c
@@ -76,8 +76,8 @@ static void compute_disassembly(GLoadedBinary *, GProcContext *, wgroup_id_t, Gt
static void process_all_instructions(wgroup_id_t gid, GtkStatusStack *status, const char *msg, ins_fallback_cb fallback, GArchProcessor *proc, GProcContext *ctx, GExeFormat *format)
{
- guint runs_count; /* Qté d'exécutions parallèles */
size_t ins_count; /* Quantité d'instructions */
+ guint runs_count; /* Qté d'exécutions parallèles */
size_t run_size; /* Volume réparti par exécution*/
GWorkQueue *queue; /* Gestionnaire de différés */
activity_id_t id; /* Identifiant de progression */
@@ -86,15 +86,13 @@ static void process_all_instructions(wgroup_id_t gid, GtkStatusStack *status, co
size_t end; /* Fin d'un bloc de traitement */
GInstructionsStudy *study; /* Tâche d'étude à programmer */
- runs_count = get_max_online_threads();
-
g_arch_processor_lock(proc);
ins_count = g_arch_processor_count_instructions(proc);
g_arch_processor_unlock(proc);
- run_size = ins_count / runs_count;
+ run_size = compute_run_size(ins_count, &runs_count);
queue = get_work_queue();
@@ -160,9 +158,7 @@ static void process_all_routines(GLoadedBinary *binary, wgroup_id_t gid, GtkStat
sym_count = g_binary_format_count_symbols(format);
- runs_count = get_max_online_threads();
-
- run_size = sym_count / runs_count;
+ run_size = compute_run_size(sym_count, &runs_count);
queue = get_work_queue();