gzip


running gzip on sigle core in muticore environment under unix


I have a requirement to use only single core to test gzip performance in multi-core cpu environment(not sure what is the default settings for gzip in this case). Need help to find out the command to execute gzip compression in single core.
Thanks
gzip is single threaded by default so in effect it will look like it's running on one core ie it might run on several physical cores but it won't be in parallel.
If you absolutely must run on one core and you're on linux you would set affinity to a particular core.
http://man7.org/linux/man-pages/man2/sched_setaffinity.2.html
This is code that I got from the man page.
#define _GNU_SOURCE
#include <sched.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/wait.h>
#define errExit(msg) do { perror(msg); exit(EXIT_FAILURE); \
} while (0)
int
main(int argc, char *argv[])
{
cpu_set_t set;
int parentCPU, childCPU;
int nloops, j;
if (argc != 4) {
fprintf(stderr, "Usage: %s parent-cpu child-cpu num-loops\n",
argv[0]);
exit(EXIT_FAILURE);
}
parentCPU = atoi(argv[1]);
childCPU = atoi(argv[2]);
nloops = atoi(argv[3]);
CPU_ZERO(&set);
switch (fork()) {
case -1: /* Error */
errExit("fork");
case 0: /* Child */
CPU_SET(childCPU, &set);
if (sched_setaffinity(getpid(), sizeof(set), &set) == -1)
errExit("sched_setaffinity");
for (j = 0; j < nloops; j++)
getppid();
exit(EXIT_SUCCESS);
default: /* Parent */
CPU_SET(parentCPU, &set);
if (sched_setaffinity(getpid(), sizeof(set), &set) == -1)
errExit("sched_setaffinity");
for (j = 0; j < nloops; j++)
getppid();
wait(NULL); /* Wait for child to terminate */
exit(EXIT_SUCCESS);
}
}
If you need to test with no interruptions from the kernel you need to write a kernel module for that.

Related Links

Is there any external tool which will give a matching checksum to gzip -lv?
Can I open a file from specific offset1 to specific offset 2
Safari Does'nt accept gzipped content?
Reading last lines of gzipped text file
How to get JMeter to request gzipped content?
Check the total content size of a tar gz file
Reversing the effects of mkimage to get an original gzipped file back
How can I check that the nginx gzip_static module is working?
Creating a gzip stream using zlib
Applying GZIP for a website under IIS?
How to check if a Unix .tar.gz file is a valid file without uncompressing?
gzip several files and pipe them into one input
Accept-Encoding headers being sent by browser but not received by server
serving gziped files only - a good idea?
Combining deflate and minify - am i creating overhead?
How can I decompress a gzip stream with zlib?

Categories

HOME
vue.js
sidekiq
symfony
ssas-2012
elixir
crate
puzzle
scipy
uibutton
avro
windows-store-apps
adsense
iis-7.5
file-io
constructor
height
ipfs
postmessage
cloudflare
lenskit
alfresco-share
saiku
ms-access-2007
internet-explorer-8
styles
raphael
bootstrap-typeahead
csh
badge
image-quality
unpack
helper
dd-wrt
clockwork
consumer
rhomobile
npm-shrinkwrap
rhino
viewstate
lego
oscommerce
boilerplate
flex4.5
onbackpressed
exiftool
ical-dotnet
ssh.net
android-maps-v2
homekit
scalafx
encapsulation
3scale
ideone
production-environment
dimple.js
chunked-encoding
livescribe
rhel6
workflow-foundation-4.5
slidesjs
visual-studio-templates
restivejs
garrys-mod
pdfkit
sql-import-wizard
libreadline
excon
linkageerror
boost-hana
spring-lemon
flexjson
direct3d12
zuora
mysqldumpslow
uialertview
graphical-logo
apache-mina
hiera
hana-xs
libsndfile
mser
errorprovider
adcolony
suffix-array
code-testing
alertifyjs
kraken.js
lumx
dvcs
factors
confusion-matrix
windows-mobile-6
dllexport
backbone-relational
pep8
abnf
android-4.0
usn
radchart
concurrent-programming
msgbox
nssavepanel
path-manipulation
nsindexpath
scraperwiki
gtk2hs
smooth
symbol-server
carbide
clients
aio
document-library

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App