From b85d96d354aadcdba6598f37d3d684898dc3b9ba Mon Sep 17 00:00:00 2001 From: Lukas Lalinsky Date: Sun, 25 Feb 2024 15:42:35 +0100 Subject: [PATCH] Remove old tools --- src/tools/fpdumpindex.cpp | 26 ---------------- src/tools/fpsearch.cpp | 64 --------------------------------------- src/tools/fpstats.cpp | 48 ----------------------------- 3 files changed, 138 deletions(-) delete mode 100644 src/tools/fpdumpindex.cpp delete mode 100644 src/tools/fpsearch.cpp delete mode 100644 src/tools/fpstats.cpp diff --git a/src/tools/fpdumpindex.cpp b/src/tools/fpdumpindex.cpp deleted file mode 100644 index fd85a43b..00000000 --- a/src/tools/fpdumpindex.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include "index/segment_index.h" -#include "index/segment_index_reader.h" -#include "store/mmap_input_stream.h" - -using namespace Acoustid; - -int main(int argc, char **argv) -{ - std::unique_ptr inputStream(MMapInputStream::open("segment0.fii")); - std::unique_ptr indexReader(new SegmentIndexReader(inputStream.get())); - SegmentIndexSharedPtr index(indexReader->read()); - - QTextStream out(stdout); - for (size_t i = 0; i < index->levelKeyCount(0); i++) { - out << index->levelKey(i) << endl; - } - - return 0; -} - diff --git a/src/tools/fpsearch.cpp b/src/tools/fpsearch.cpp deleted file mode 100644 index 16e3917a..00000000 --- a/src/tools/fpsearch.cpp +++ /dev/null @@ -1,64 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include "index/segment_data_reader.h" -#include "index/segment_index.h" -#include "index/segment_index_reader.h" -#include "index/segment_searcher.h" -#include "index/top_hits_collector.h" -#include "store/mmap_input_stream.h" -#include "store/fs_input_stream.h" -#include "util/timer.h" - -using namespace Acoustid; - -int main(int argc, char **argv) -{ - //InputStream *inputStream = FSInputStream::open("segment0.fii"); - InputStream *inputStream = FSInputStream::open("segment_0.fii"); - InputStream *dataInputStream = FSInputStream::open("segment_0.fid"); - SegmentIndexReader *indexReader = new SegmentIndexReader(inputStream); - SegmentIndexSharedPtr index = indexReader->read(); - - qDebug() << "BlockSize =" << index->blockSize(); - qDebug() << "KeyCount0 =" << index->levelKeyCount(0); - -// dataInputStream->setBufferSize(index->blockSize()); - SegmentDataReader *dataReader = new SegmentDataReader(dataInputStream, index->blockSize()); - - uint32_t fp[] = { - //-965422978,-952364817,-986246953,-1003080754,1144403678,1142324974,1414823663,1414851167,1431629645,1448451853,1180141324,1180013404,1198912380,-948603939,-982035489,-984201729,-983640721,-975313553,-979507921,-943721201,-944390129,-961167297,-957034385,-969649937,-986377993,-1003081266,-1003080993,-1005175057,-1001054481,-992728451,-975934900,-942276852,-958937332,-963128548,-943852740,-943857284,-2017463811,-2051091969,-2049075730,-2023965202,-2023965330,-2015457978,-2097249210,-1024024562,-1033506786,-1020440466,-1052831497,-1070190130,1144402654,1142298350,1415012079,1423244015,1440016973,1465167693,1448580940,1180144460,1180013436,-967511043,-950570019,-984198689,-984197777,-992608913,-711070417,-711465713,-944258033,-944390129,-961228689,-965422993,-952889105,-986304034,-1003081010,-1005177090,-1000972561,-1001096593,-975934900,-950736116,-967319796,-967342308,-959065284,-940183188,-943721988,-2019569185,-2053127954,-2049141522,-2057524114,-2023908242,-2015984562,-956895154,-956829618,-969584529,-952299281,-985722465,1144402830,1412839166,1414930159,1423212271,1423206989,1473572429,1456848717,1180141324,1182110556,1182135165,-948603939,-948481569,-984201873,-1000876689,-992154321,-711072449,-675818225,-944390129,-961232833,-957034385,-952876817,-986246913,-1003080818,-1005178210,-1005183250,-1001055505,-992728355,-975934516 - 1,2,3,4,5,6 - }; - size_t fpSize = sizeof(fp) / sizeof(fp[0]); - std::sort(fp, fp + fpSize); - - TopHitsCollector collector(10); - - SegmentSearcher searcher(index, dataReader); - - Timer timer; - timer.start(); - - searcher.search(fp, fpSize, &collector); - qDebug() << "Index search took" << timer.elapsed() << "ms"; - - QList results = collector.topResults(); - for (size_t i = 0; i < results.size(); i++) { - qDebug() << "Found" << results[i].id() << "with score" << results[i].score(); - } - - delete indexReader; - delete inputStream; - - delete dataInputStream; - delete dataReader; - - return 0; -} - diff --git a/src/tools/fpstats.cpp b/src/tools/fpstats.cpp deleted file mode 100644 index 7cd5df18..00000000 --- a/src/tools/fpstats.cpp +++ /dev/null @@ -1,48 +0,0 @@ -#include -#include -#include -#include -#include - -int main(int argc, char **argv) -{ - QTextStream in(stdin); - - unsigned long counts[256]; - memset(counts, 0, sizeof(counts)); - - unsigned long long sum = 0; - - int bits = 8; - bool first = false; - - uint32_t mask, shift; - if (first) { - mask = ((1 << bits) - 1); - shift = 0; - } - else { - mask = 0xffffffff; - shift = 32 - bits; - } - - qDebug() << mask; - - while (!in.atEnd()) { - uint32_t key, value; - in >> key >> value; - if (in.status() != QTextStream::Ok) - break; - counts[(key & mask) >> shift]++; - sum++; - } - - unsigned long long sum2 = 0; - for (int i = 0; i < (1 << bits); i++) { - qDebug() << i << counts[i] << (100.0 * counts[i] / sum); - sum2 += counts[i]; - } - - return 0; -} -