Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Telemetry: Rename old file instead of copying #3506

Merged
merged 1 commit into from
Mar 23, 2024

Conversation

Sonicadvance1
Copy link
Member

@Sonicadvance1 Sonicadvance1 commented Mar 22, 2024

Since we do an immediate overwrite of the file we are copying, we can instead do a rename. Failure on rename is fine, will either mean the telemetry file didn't exist initially, or some other permission error so the telemetry will get lost regardless.

Basic renaming is also faster which is a nice benefit:

  • renameat syscall: 0.000179 seconds

Old exist check + copy (sequence of syscalls):

  • faccessat: 0.000027 s
  • faccessat: 0.000011 s (directory cached in kernel now?)
  • openat: 0.000016 s
  • openat: 0.000104 s
  • newfstatat: 0.000007 s
  • fchmod: 0.000010 s
  • sendfile: 0.000049 s
  • close: 0.000065 s
  • close: 0.000005 s
    Total: 0.000294 s

Since we do an immediate overwrite of the file we are copying, we can
instead do a rename. Failure on rename is fine, will either mean the
telemetry file didn't exist initially, or some other permission error so
the telemetry will get lost regardless.
@lioncash lioncash merged commit 002ca36 into FEX-Emu:main Mar 23, 2024
10 checks passed
@Sonicadvance1 Sonicadvance1 deleted the telemetry_rename branch March 23, 2024 04:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants