#include #include #include #include "energy_bench.h" void swap(int *arr, int i, int j) { int temp = arr[i]; arr[i] = arr[j]; arr[j] = temp; } void bubbleSort(int *arr, int n) { for (int i = 0; i < n - 1; i++) { for (int j = 0; j < n - i - 1; j++) { if (arr[j] > arr[j + 1]) { swap(arr, j, j + 1); } } } } int main() { const int N = 25000; int arr[N]; for (int i = 0; i < N; i++) { arr[i] = rand(); } EnergyInfo *einfo = start_energy_measure(); bubbleSort(arr, N); EnergyResult *res = stop_energy_measure(einfo); print_energy_results(&res); free_energy_results(res); return 0; }