On Tue, Aug 4, 2009 at 10:13 AM, <[email protected]> wrote:
>
> Hello,
>
> I'm using the following Code to do a pretty simple operation in an
> array of structs. I'm looking throug one array, that indicates that
> that array element in the array of structs is used. If that is the
> case one of the values in the corresponding line is reduced by 1 and
> checked for 0.
>
> However this task, when compiled has my RAM-requirement jump from ~2kB
> to ~3kB, i.e. 50%. Can any of you give me a hint on how to do this
> better, i.e. more efficient??
>
> Both table have 64 "lines" and about 11 "columns" of 8 and 16 bit
> unsigned ints.
>
> Thanks
>
> Tobias
>
> Code:
>
> task void decrease_timeouts_task() {
>        uint8_t arr;
>        uint8_t i;
>        printf("TASK STARTED \n"); printfflush();
>        for (arr = 0; arr < 8; arr++) {
>                if (c_dest_occ[arr] != 0) {
>                        for (i = 0; i < 8; i++) {
>                                if (c_dest_occ[arr] >> i == 1) {
>                                        c_dest_table[arr*8+i].t_timeout_cnt -= 
> 1;
>                                        printf("HCTableP - decreased %X \n", 
> (arr*8+i));
>                                         printfflush();
>                                        if 
> (c_dest_table[arr*8+i].t_timeout_cnt == 0) {
>                                                call 
> HC_TABLE.remove_cdest(arr*8+i);
>                                        }
>                                }
>                        }
>                } else if (c_long_occ[arr] != 0) {
>                        for (i = 0; i < 8; i++) {
>                                if (c_long_occ[arr] >> i == 1) {
>                                        c_long_table[arr*8+i].t_timeout_cnt -= 
> 1;
>                                        if 
> (c_long_table[arr*8+i].t_timeout_cnt == 0) {
>                                                call 
> HC_TABLE.remove_clong(arr*8+i);
>                                        }
>                                }
>                        }
>                }
>        }
>
>    }
>


I would guess that w/o this func the table gets optimized away.

64*11'ish = 704 or so words, so along with the actual code for this
function could very well use over 1kB of RAM.

_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to