예제 #1
0
static inline struct interrupt *get_interrupts_array(int lines, int cpus) {
    static struct interrupt *irrs = NULL;
    static int allocated = 0;

    if(unlikely(lines > allocated)) {
        irrs = (struct interrupt *)reallocz(irrs, lines * recordsize(cpus));
        allocated = lines;
    }

    return irrs;
}
예제 #2
0
static inline struct interrupt *get_interrupts_array(int lines, int cpus) {
	static struct interrupt *irrs = NULL;
	static int allocated = 0;

	if(lines < allocated) return irrs;
	else {
		irrs = (struct interrupt *)realloc(irrs, lines * recordsize(cpus));
		if(!irrs)
			fatal("Cannot allocate memory for %d interrupts", lines);

		allocated = lines;
	}

	return irrs;
}
예제 #3
0
static inline struct interrupt *get_interrupts_array(uint32_t lines, int cpus) {
    static struct interrupt *irrs = NULL;
    static uint32_t allocated = 0;

    if(unlikely(lines != allocated)) {
        uint32_t l;
        int c;

        irrs = (struct interrupt *)reallocz(irrs, lines * recordsize(cpus));

        // reset all interrupt RRDDIM pointers as any line could have shifted
        for(l = 0; l < lines ;l++) {
            struct interrupt *irr = irrindex(irrs, l, cpus);
            irr->rd = NULL;
            irr->name[0] = '\0';
            for(c = 0; c < cpus ;c++)
                irr->cpu[c].rd = NULL;
        }

        allocated = lines;
    }

    return irrs;
}