int id; // Peer id
simgrid::s4u::Mailbox* mailbox_;
unsigned int bitfield = 0U; // Fields
- // int messages_count;
double peer_speed = 0;
double last_unchoke = 0;
int current_piece = -1;
}
/** A blocking (`wait()`-based) future for SIMIX processes */
-// TODO, .wait_for()
-// TODO, .wait_until()
+// TODO, .wait_for
+// TODO, .wait_until
// TODO, SharedFuture
// TODO, simgrid::simix::when_all - wait for all future to be ready (this one is simple!)
// TODO, simgrid::simix::when_any - wait for any future to be ready
if (!dynar) /* iterating over a NULL dynar is a no-op */
return 0;
- if (idx >= dynar->used) {
- //XBT_DEBUG("Cursor on %p already on last elem", (void *) dynar);
+ if (idx >= dynar->used)
return 0;
- }
- // XBT_DEBUG("Cash out cursor on %p at %u", (void *) dynar, *idx);
memcpy(dst, ((char *) dynar->data) + idx * dynar->elmsize, dynar->elmsize);
/* Node structure */
/* Be careful of what you do with this structure */
-/* typedef struct xbt_node *xbt_node_t; */
typedef struct xbt_node {
xbt_dynar_t out;
xbt_dynar_t in; /* not used when the graph is directed */
/* edge structure */
/* Be careful of what you do with this structure */
-/* typedef struct xbt_edge *xbt_edge_t; */
typedef struct xbt_edge {
xbt_node_t src;
xbt_node_t dst;
/* Graph structure */
/* Be careful of what you do with this structure */
-/* typedef struct xbt_graph *xbt_graph_t; */
typedef struct xbt_graph {
xbt_dynar_t nodes;
xbt_dynar_t edges;
call_deleter<T>((T*)this, elem, it.first,it.second,&flag);
}
} else {
- //already deleted, not a problem;
+ // already deleted, not a problem
flag=0;
}
}
xbt_automaton_state_t state_dst = xbt_automaton_state_exists(parsed_automaton, id);
xbt_automaton_state_t state_src = xbt_automaton_state_exists(parsed_automaton, state_id_src);
- //xbt_transition_t trans = NULL;
xbt_automaton_transition_new(parsed_automaton, state_src, state_dst, label);
}
size_t i;
int it;
-// fprintf(stderr,"free(%p)\n",ptr);
-
if (ptr == NULL)
return;
block = i;
} else {
- //fprintf(stderr,"Free block %d to %d (as a new chunck)\n",block,block+mdp->heapinfo[block].busy_block.size);
/* Really link this block back into the free list. */
mdp->heapinfo[block].free_block.size = mdp->heapinfo[block].busy_block.size;
mdp->heapinfo[block].free_block.next = mdp->heapinfo[i].free_block.next;
}
/* Now see if we can return stuff to the system. */
- /* blocks = mdp -> heapinfo[block].free.size;
+#if 0
+ blocks = mdp -> heapinfo[block].free.size;
if (blocks >= FINAL_FREE_BLOCKS && block + blocks == mdp -> heaplimit
&& mdp -> morecore (mdp, 0) == ADDRESS (block + blocks))
{
block = mdp -> heapinfo[block].free.prev;
mdp -> heapstats.chunks_free--;
mdp -> heapstats.bytes_free -= bytes;
- } */
+ }
+#endif
/* Set the next search to begin at this block.
This is probably important to the trick where realloc returns the block to
mdp->heapinfo[block].busy_frag.frag_size[frag_nb] = -1;
mdp->heapinfo[block].busy_frag.ignore[frag_nb] = 0;
-// fprintf(stderr,"nfree:%zu capa:%d\n", mdp->heapinfo[block].busy_frag.nfree,(BLOCKSIZE >> type));
if (mdp->heapinfo[block].busy_frag.nfree ==
(BLOCKSIZE >> type) - 1) {
/* If all fragments of this block are free, remove this block from its swag and free the whole block. */
{
/* Do not destroy the default mdp or ldl won't be able to free the memory it
* allocated since we're in memory */
- // xbt_mheap_destroy_no_free(__mmalloc_default_mdp);
+ // xbt_mheap_destroy_no_free(__mmalloc_default_mdp)
}
// This is the underlying implementation of mmalloc_get_bytes_used_remote.
if (size < SMALLEST_POSSIBLE_MALLOC)
size = SMALLEST_POSSIBLE_MALLOC;
- // printf("(%s) Mallocing %d bytes on %p (default: %p)...",xbt_thread_self_name(),size,mdp,__mmalloc_default_mdp);fflush(stdout);
-
if (!(mdp->flags & MMALLOC_INITIALIZED))
initialize(mdp);
mdp -> heapstats.bytes_free -= blocks * BLOCKSIZE;
}
- //printf("(%s) Done mallocing. Result is %p\n",xbt_thread_self_name(),result);fflush(stdout);
return (result);
}
return mmalloc(mdp, size);
}
- //printf("(%s)realloc %p to %d...",xbt_thread_self_name(),ptr,(int)size);
-
if ((char *) ptr < (char *) mdp->heapbase || BLOCK(ptr) > mdp->heapsize) {
printf("FIXME. Ouch, this pointer is not mine, refusing to proceed (another solution would be to malloc "
"it instead of reallocing it, see source code)\n");
if (blocks < mdp->heapinfo[block].busy_block.size) {
int it;
/* The new size is smaller; return excess memory to the free list. */
- //printf("(%s) return excess memory...",xbt_thread_self_name());
for (it= block+blocks; it< mdp->heapinfo[block].busy_block.size ; it++){
mdp->heapinfo[it].type = MMALLOC_TYPE_UNFRAGMENTED; // FIXME that should be useless, type should already be 0 here
mdp->heapinfo[it].busy_block.ignore = 0;
mdp->heaplimit = oldlimit;
result = mmalloc_no_memset(mdp, requested_size);
- //fprintf(stderr,"remalloc(%zu)~>%p\n",requested_size,result);
if (ptr != result)
memmove(result, ptr, blocks * BLOCKSIZE);
if (size > (size_t) (1 << (type - 1)) && size <= (size_t) (1 << type)) {
/* The new size is the same kind of fragment. */
- //printf("(%s) new size is same kind of fragment...",xbt_thread_self_name());
result = ptr;
int frag_nb = RESIDUAL(result, BLOCKSIZE) >> type;
} else { /* fragment -> Either other fragment, or block */
/* The new size is different; allocate a new space,
and copy the lesser of the new size and the old. */
- //printf("(%s) new size is different...",xbt_thread_self_name());
result = mmalloc(mdp, requested_size);
}
break;
}
- //printf("(%s) Done reallocing: %p\n",xbt_thread_self_name(),result);fflush(stdout);
return (result);
}