Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions backend/controllers/benchmarkResultController.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ import { logger } from '../utils/logger.js';
export const receiveBenchmarkResult = async (req, res) => {
try {
const data = req.body;

console.log('\n=== Complete Data ===\n');
console.log(JSON.stringify(data, null, 2));
console.log('\n=====================================\n');

// Check for duplicate based on combination of circuit, framework, language, and androidId
const androidId = data.deviceInfo?.androidId;
const circuit = data.circuit;
const framework = data.framework;
const language = data.language;

if (androidId && circuit && framework && language) {
// Query Firestore to check if this exact combination already exists
const existingSnapshot = await db.collection(COLLECTION_NAMES.BENCHMARKS)
Expand All @@ -28,7 +28,7 @@ export const receiveBenchmarkResult = async (req, res) => {
.where('language', '==', language)
.limit(1)
.get();

if (!existingSnapshot.empty) {
logger.info(`Duplicate benchmark detected - Circuit: ${circuit}, Framework: ${framework}, Language: ${language}, AndroidId: ${androidId}`);
return res.status(200).json({
Expand All @@ -42,22 +42,22 @@ export const receiveBenchmarkResult = async (req, res) => {
});
}
}

// Add the benchmark data to Firestore
const docRef = await db.collection(COLLECTION_NAMES.BENCHMARKS).add({
...data,
createdAt: new Date().toISOString()
});

logger.info(`Benchmark data saved successfully with ID: ${docRef.id}`);

res.status(201).json({
success: true,
message: 'Benchmark result received and saved successfully',
documentId: docRef.id,
receivedAt: new Date().toISOString()
});

} catch (error) {
logger.error('Error receiving benchmark result:', error);
res.status(500).json({ error: error.message });
Expand Down
65 changes: 29 additions & 36 deletions benchmarking-suite/moPro/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading