Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
BenBrock committed Aug 28, 2024
1 parent 4925e48 commit 9e3ccfd
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 14 deletions.
6 changes: 3 additions & 3 deletions examples/benchmark_read.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ double compute_variance(double* x, size_t n) {

void flush_cache() {
#ifdef __APPLE__
system("bash -c \"sync && sudo purge\"");
int rv = system("bash -c \"sync && sudo purge\"");
#elif __linux__
system("bash -c \"sync\" && sudo sh -c \"/usr/bin/echo 3 > "
"/proc/sys/vm/drop_caches\"");
int rv = system("bash -c \"sync\" && sudo sh -c \"/usr/bin/echo 3 > "
"/proc/sys/vm/drop_caches\"");
#else
static_assert(false);
#endif
Expand Down
6 changes: 3 additions & 3 deletions examples/benchmark_read_parallel.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ double compute_variance(double* x, size_t n) {

void flush_cache() {
#ifdef __APPLE__
system("bash -c \"sync && sudo purge\"");
int rv = system("bash -c \"sync && sudo purge\"");
#elif __linux__
system("bash -c \"sync\" && sudo sh -c \"/usr/bin/echo 3 > "
"/proc/sys/vm/drop_caches\"");
int rv = system("bash -c \"sync\" && sudo sh -c \"/usr/bin/echo 3 > "
"/proc/sys/vm/drop_caches\"");
#else
static_assert(false);
#endif
Expand Down
12 changes: 6 additions & 6 deletions examples/benchmark_write.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ double compute_variance(double* x, size_t n) {

void flush_cache() {
#ifdef __APPLE__
system("bash -c \"sync && sudo purge\"");
int rv = system("bash -c \"sync && sudo purge\"");
#elif __linux__
system("bash -c \"sync\" && sudo sh -c \"/usr/bin/echo 3 > "
"/proc/sys/vm/drop_caches\"");
int rv = system("bash -c \"sync\" && sudo sh -c \"/usr/bin/echo 3 > "
"/proc/sys/vm/drop_caches\"");
#else
static_assert(false);
#endif
Expand All @@ -54,9 +54,9 @@ void flush_cache() {

void flush_writes() {
#ifdef __APPLE__
system("bash -c \"sync\"");
int rv = system("bash -c \"sync\"");
#elif __linux__
system("bash -c \"sync\"");
int rv = system("bash -c \"sync\"");
#else
static_assert(false);
#endif
Expand All @@ -65,7 +65,7 @@ void flush_writes() {
void delete_file(char* file_name) {
char command[2048];
snprintf(command, 2047, "rm %s", file_name);
system(command);
int rv = system(command);
}

int main(int argc, char** argv) {
Expand Down
1 change: 1 addition & 0 deletions include/binsparse/detail/shm_tools.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include <stddef.h>
#include <stdio.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/stat.h>
Expand Down
6 changes: 4 additions & 2 deletions include/binsparse/matrix_market/matrix_market_inspector.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ bsp_mm_metadata bsp_mmread_metadata(char* file_path) {

bsp_mm_metadata metadata;

fscanf(f, "%%%%MatrixMarket matrix %s %s %s\n", metadata.format,
metadata.type, metadata.structure);
int read_items = fscanf(f, "%%%%MatrixMarket matrix %s %s %s\n",
metadata.format, metadata.type, metadata.structure);

assert(read_items == 3);

for (size_t i = 0; i < strlen(metadata.structure); i++) {
metadata.structure[i] = tolower(metadata.structure[i]);
Expand Down

0 comments on commit 9e3ccfd

Please sign in to comment.