Beispiel #1
0
void main() {
	int** Y;
	int** A;
	int** B;

	int i,j,k;

	Y = (int**)malloc(sizeof(int*)*MATRIX_DIM);
	A = (int**)malloc(sizeof(int*)*MATRIX_DIM);
	B = (int**)malloc(sizeof(int*)*MATRIX_DIM);

	for (i=0; i < MATRIX_DIM; i++) {
		Y[i] = (int*)malloc(sizeof(int)*MATRIX_DIM);
		A[i] = (int*)malloc(sizeof(int)*MATRIX_DIM);
		B[i] = (int*)malloc(sizeof(int)*MATRIX_DIM);
	}

	struct bigint bi;
	perfPoll(0);

	for (i=0; i < MATRIX_DIM; i++) {
		for (j=0; j < MATRIX_DIM; j++) {
			for (k=0; k < MATRIX_DIM; k++) {
				Y[i][j] = Y[i][j] + A[i][k] * B[k][j];
			}
		}
	}

	perfPoll(0);
	for(;;){}
}
Beispiel #2
0
void CCNDriver::readEvents(mxml_node_t *const) {
	struct stat st;
	if (stat("/sys/bus/event_source/devices/ccn", &st) != 0) {
		// Not found
		return;
	}

	int type;
	if (DriverSource::readIntDriver("/sys/bus/event_source/devices/ccn/type", &type) != 0) {
		logg.logError("Unable to read CCN-5xx type");
		handleException();
	}

	// Detect number of xps
	struct perf_event_attr pea;
	memset(&pea, 0, sizeof(pea));
	pea.type = type;
	pea.size = sizeof(pea);

	mXpCount = 1;
	while (true) {
		pea.config = getConfig(0, 0x08, 1, 0, 1) | mXpCount;
		if (!perfPoll(&pea)) {
			break;
		}
		mXpCount *= 2;
	};
	{
		int lower = mXpCount/2 + 1;
		while (lower < mXpCount) {
			int mid = (lower + mXpCount)/2;
			pea.config = getConfig(0, 0x08, 1, 0, 1) | mid;
			if (perfPoll(&pea)) {
				lower = mid + 1;
			} else {
				mXpCount = mid;
			}
		}
	}

	mNodeTypes = new NodeType[2*mXpCount];

	// Detect node types
	for (int i = 0; i < 2*mXpCount; ++i) {
		pea.config = getConfig(0, 0x04, 1, 0, 0) | i;
		if (perfPoll(&pea)) {
			mNodeTypes[i] = NT_HNF;
			continue;
		}

		pea.config = getConfig(0, 0x16, 1, 0, 0) | i;
		if (perfPoll(&pea)) {
			mNodeTypes[i] = NT_RNI;
			continue;
		}

		pea.config = getConfig(0, 0x10, 1, 0, 0) | i;
		if (perfPoll(&pea)) {
			mNodeTypes[i] = NT_SBAS;
			continue;
		}

		mNodeTypes[i] = NT_UNKNOWN;
	}
}