From f8c3ae6cc74e1765c39ea5a019315417df6bbf3e Mon Sep 17 00:00:00 2001 From: Adam Treat Date: Tue, 2 May 2023 16:24:06 -0400 Subject: [PATCH] Some more startup info to help determine what hardware we need to support. --- network.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/network.cpp b/network.cpp index 30cf8b0b..51cbf01b 100644 --- a/network.cpp +++ b/network.cpp @@ -2,15 +2,27 @@ #include "llm.h" #include +#include #include #include #include #include #include #include +#include //#define DEBUG +#ifdef __APPLE__ +#include +std::string getCPUModel() { + char buffer[256]; + size_t bufferlen = sizeof(buffer); + sysctlbyname("machdep.cpu.brand_string", &buffer, &bufferlen, NULL, 0); + return std::string(buffer); +} +#endif + class MyNetwork: public Network { }; Q_GLOBAL_STATIC(MyNetwork, networkInstance) Network *Network::globalInstance() @@ -234,6 +246,20 @@ void Network::sendMixpanelEvent(const QString &ev) + QCoreApplication::applicationVersion()); properties.insert("model", LLM::globalInstance()->chatListModel()->currentChat()->modelName()); + // Some additional startup information + if (ev == "startup") { + const QSize display = QGuiApplication::primaryScreen()->size(); + properties.insert("display", QString("%1x%2").arg(display.width()).arg(display.height())); +#if defined(__x86_64__) || defined(__i386__) + properties.insert("avx", __builtin_cpu_supports("avx")); + properties.insert("avx2", __builtin_cpu_supports("avx2")); + properties.insert("fma", __builtin_cpu_supports("fma")); +#endif +#ifdef __APPLE__ + properties.insert("cpu", QString::fromStdString(getCPUModel())); +#endif + } + QJsonObject event; event.insert("event", ev); event.insert("properties", properties);