Trace compression improvements
Devin Samarin
devin at oftn.org
Wed Jun 5 10:31:42 PDT 2013
We've fixed a few problems in these patches that break building with
MSVC. Functions with a non-void type need to return something. I
recommend -Wall -Werror -Wextra -pedantic for strict
standards-compliance for new code.
>From be29aa0defa0395bb02c650d05a7d6cd663e9684 Mon Sep 17 00:00:00 2001
From: Tamir Atias <engine.games at gmail.com>
Date: Wed, 5 Jun 2013 02:08:01 +0300
Subject: [PATCH] Fixes to make code build with MSVC.
---
common/os_thread.hpp | 2 +-
common/trace_threaded_file.cpp | 7 ++++++-
common/trace_threaded_file.hpp | 2 +-
3 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/common/os_thread.hpp b/common/os_thread.hpp
index c35febe..2a9ca38 100644
--- a/common/os_thread.hpp
+++ b/common/os_thread.hpp
@@ -432,7 +432,7 @@ typedef HANDLE Mutex;
#define THREAD_ROUTINE WINAPI
-static inline Thread ThreadCreate(void *(WINAPI * routine)(void *),
+static inline Thread ThreadCreate(void *(routine)(void *),
void *param) {
DWORD id;
return CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) routine,
diff --git a/common/trace_threaded_file.cpp b/common/trace_threaded_file.cpp
index 9553c75..dee1ba5 100644
--- a/common/trace_threaded_file.cpp
+++ b/common/trace_threaded_file.cpp
@@ -112,7 +112,7 @@ size_t
CompressionCache::readAndCompressBuffer(char *buffer, size_t
&inputLength
return compressedLength;
}
-THREAD_ROUTINE void * ThreadedFile::compressorThread(void * param) {
+void* ThreadedFile::compressorThread(void* param) {
ThreadedFile *file = (ThreadedFile *) param;
char * compressedData = new
char[file->m_library->maxCompressedLength(file->CACHE_SIZE)];
file->m_cache->acquireReadControl();
@@ -164,11 +164,13 @@ bool ThreadedFile::rawOpen(const std::string
&filename, enum Mode mode) {
size_t ThreadedFile::rawRead(void *buffer, size_t length) {
os::log("apitrace: threaded file read function access \n");
os::abort();
+ return 0;
}
int ThreadedFile::rawGetc() {
os::log("apitrace: threaded file read function access \n");
os::abort();
+ return 0;
}
void ThreadedFile::rawClose() {
@@ -195,6 +197,7 @@ void ThreadedFile::rawFlush() {
bool ThreadedFile::rawSkip(size_t length) {
os::log("apitrace: threaded file read function access \n");
os::abort();
+ return 0;
}
bool ThreadedFile::supportsOffsets() const {
@@ -204,6 +207,7 @@ bool ThreadedFile::supportsOffsets() const {
File::Offset ThreadedFile::currentOffset() {
os::log("apitrace: threaded file read function access \n");
os::abort();
+ return 0;
}
void ThreadedFile::setCurrentOffset(const File::Offset &offset) {
@@ -220,6 +224,7 @@ void ThreadedFile::writeLength(size_t length) {
int ThreadedFile::rawPercentRead() {
os::log("apitrace: threaded file read function access \n");
os::abort();
+ return 0;
}
ThreadedFile* File::createThreadedFile() {
diff --git a/common/trace_threaded_file.hpp b/common/trace_threaded_file.hpp
index 84bbe0c..dc4dfde 100644
--- a/common/trace_threaded_file.hpp
+++ b/common/trace_threaded_file.hpp
@@ -170,7 +170,7 @@ private:
void writeLength(size_t length);
- THREAD_ROUTINE static void * compressorThread(void * param);
+ static void* compressorThread(void* param);
};
--
1.7.9
On Tue, Jun 4, 2013 at 1:14 PM, Eugene Velesevich
<eugvelesevich at gmail.com> wrote:
> The best improvements we've seen were on an arm/android board, where
> the threaded approach eliminated very noticeable periodic stutters
> from compression; however, it's hard to provide quantitative data on
> that. On a modern x86 system, we're seeing 7-8% better fps rates with
> ipers, even with lz4hc compression that consumes 30-40% cpu in its
> thread.
>
> With regards to compression ratio the LZ4 compressed trace of ipers is
> larger by 11-12% than the snappy one, but LZ4HC compresses better by
> 35-36% than snappy (you can check it using "apitrace repack")
>
> On Sun, Jun 2, 2013 at 5:09 PM, José Fonseca <jose.r.fonseca at gmail.com> wrote:
>> I haven't looked at the changes in detail yet -- I'll do it as soon as I
>> find the time -- but sounds good in principle. Indeed trying out LZ4 has
>> been in the to do for some time, so thanks for doing this.
>>
>> Did you get any figures (speed r& compression ratio) on how it compares with
>> snappy? A good benchmark is "ipers" demo, part of mesa demos. It is what
>> Zack used when he was improving the compression speed w/ snappy.
>>
>> Jose
>>
>>
>>
>> On Sat, Jun 1, 2013 at 2:39 PM, evel <evel at ispras.ru> wrote:
>>>
>>> Hello,
>>>
>>> This patch series improves trace compression by implementing threaded
>>> compression offloading and providing alternative compression methods. The
>>> main difference from previously implemented threaded compression is that
>>> locking overhead is significantly reduced thanks to using a
>>> double-buffered
>>> output buffer instead of a ring buffer that was locked on each call dump
>>> operation.
>>>
>>> https://github.com/Testiki/apitrace/tree/threaded-file
>>> _______________________________________________
>>> apitrace mailing list
>>> apitrace at lists.freedesktop.org
>>> http://lists.freedesktop.org/mailman/listinfo/apitrace
>>
>>
>>
>> _______________________________________________
>> apitrace mailing list
>> apitrace at lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/apitrace
>>
> _______________________________________________
> apitrace mailing list
> apitrace at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/apitrace
More information about the apitrace
mailing list