Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use Int64 instead of Int for counters and gauges
Int wraps around too quickly. For example, if we have an event that happens 10,000 times per second, an Int counter will wrap around after 2.5 days.
- Loading branch information
Showing
6 changed files
with
52 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
#include "HsFFI.h" | ||
|
||
void hs_atomic_add(volatile StgInt* atomic, StgInt n) { | ||
void hs_atomic_add(volatile StgInt64* atomic, StgInt64 n) { | ||
__sync_fetch_and_add(atomic, n); | ||
} | ||
|
||
void hs_atomic_subtract(volatile StgInt* atomic, StgInt n) { | ||
void hs_atomic_subtract(volatile StgInt64* atomic, StgInt64 n) { | ||
__sync_fetch_and_sub(atomic, n); | ||
} | ||
|
||
StgInt hs_atomic_read(volatile const StgInt* atomic) { | ||
StgInt64 hs_atomic_read(volatile const StgInt64* atomic) { | ||
return *atomic; | ||
} | ||
|
||
void hs_atomic_write(volatile StgInt* atomic, StgInt n) { | ||
void hs_atomic_write(volatile StgInt64* atomic, StgInt64 n) { | ||
*atomic = n; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters