1
0
mirror of git://jb55.com/damus synced 2024-09-16 02:03:45 +00:00

debug: remove note size debug

ThreadSanitizer was complaining about a data race
This commit is contained in:
William Casarin 2023-08-06 09:07:09 -07:00
parent 624a7b4e88
commit a73271e3d4

View File

@ -53,12 +53,14 @@ class NdbNote: Encodable, Equatable, Hashable {
self.owned = owned_size != nil
self.count = owned_size ?? 0
#if DEBUG_NOTE_SIZE
if let owned_size {
NdbNote.total_ndb_size += Int(owned_size)
NdbNote.notes_created += 1
print("\(NdbNote.notes_created) ndb_notes, \(NdbNote.total_ndb_size) bytes")
}
#endif
}
@ -102,10 +104,12 @@ class NdbNote: Encodable, Equatable, Hashable {
deinit {
if self.owned {
#if DEBUG_NOTE_SIZE
NdbNote.total_ndb_size -= Int(count)
NdbNote.notes_created -= 1
print("\(NdbNote.notes_created) ndb_notes, \(NdbNote.total_ndb_size) bytes")
#endif
free(note)
}
}
@ -135,8 +139,10 @@ class NdbNote: Encodable, Equatable, Hashable {
try container.encode(tags, forKey: .tags)
}
#if DEBUG_NOTE_SIZE
static var total_ndb_size: Int = 0
static var notes_created: Int = 0
#endif
init?(content: String, keypair: Keypair, kind: UInt32 = 1, tags: [[String]] = [], createdAt: UInt32 = UInt32(Date().timeIntervalSince1970)) {