Sponsored Content
Top Forums Programming Compiler/Runtime uses of sizeof Post 302964655 by bigearsbilly on Sunday 17th of January 2016 05:39:40 PM
Old 01-17-2016
You seriously don't need to worry about overhead of an extra line of code.
Lets do some rough guess calculation here...
What you got a 2GHZ processor? That's 2000,000,000 cycles per second.

Lets say that extra line adds 20 cycles on the program. That's a 10 millionth of a second.
Reading a few bytes from a disk may well take in the order of milliseconds.

If you think it makes the program clearer then do it. I routinely add extra steps and variables to make my code more readable and I deal with vast amounts of 24 hour streaming data.
And my stuff flies.

Its I/O that causes bottlenecks.
 

9 More Discussions You Might Find Interesting

1. Programming

sizeof

we know that sizeof never returns zero when used with structure then why in this case it is returning zero struct foo { char c; }; void main() { struct foo f; cout<<sizeof(f); } i am working on solaris 5.8 isn't the above function should return the size of empty structure (7 Replies)
Discussion started by: ramneek
7 Replies

2. UNIX for Dummies Questions & Answers

xl C/C++ compiler to GCC compiler

Hi, we are converting from IBM-AIX(xl c/c++ compiler) to Linux(GCC complier). As a part of this i need to change the CFLAGS. The xl c/c++ complier CFLAGS is CFLAGS := $(CDEBUG) $(PROJECT_INCLUDE_DIRS) $(COBJECT_MODE) -qcpluscmt -qmakedep -qcheck=all \ -qalign=bit_packed $(LINT_FLAGS)... (0 Replies)
Discussion started by: pbattu1
0 Replies

3. Programming

How Can a Machine Reads a Compiler Since A Compiler is Written in Text! Not Binaries?

To make a programming language you need a compiler, so what was the first programming language and how was is created if you need the compiler first? The compiler itself is considered as a high language comparing to the machine! since the compiler is not created in 1's and 0's... Eventhough i... (12 Replies)
Discussion started by: f.ben.isaac
12 Replies

4. Programming

sizeof an array of structure without using 'sizeof' operator

Hi All, is it possible to find out the size of an array of structures ( without using 'sizeof' operator). The condition is we have the array of structure instant but we are not aware of the elements inside the structure. Can someone help me out? Thanks in advance. (18 Replies)
Discussion started by: rvan
18 Replies

5. Programming

How to get the sizeof char pointer

The below code throws the error, since the size of x = 19 is not passed to the cstrCopy function. using namespace std; static void cstrCopy(char *x, const char*y); int main () { char x; const string y = "UNIX FORUM"; cstrCopy(x,y.c_str()); return 0; } void cstrCopy(char *x,... (3 Replies)
Discussion started by: SamRoj
3 Replies

6. Programming

Doubts regarding sizeof() operator

Hi, There are some bewildering sizeof() questions I have in my mind. Could anyone shed some light on this? int main() { printf("%d\n", sizeof(main)); // Ans: 1 } That is, the sizeof() a function identifier though it is treated internally as a pointer gives 1 byte always, why? ... (5 Replies)
Discussion started by: royalibrahim
5 Replies

7. UNIX for Dummies Questions & Answers

cc compiler and gcc compiler

hi, can we install gcc compiler in unix based OS(sun solar,IBM AIX,HP,etc) and also can we install sun cc compiler in AIX environment and vice versa. and more ..is linux support cc compiler regards Ajay (3 Replies)
Discussion started by: ajaysahoo
3 Replies

8. Programming

sizeof(object) in C++

Hi, I have defined the class and call the sizeof(object to class) to get the size. # include <iostream> # include <iomanip> using namespace std; class sample { private: int i; float j; char k; public: sample() { } (2 Replies)
Discussion started by: ramkrix
2 Replies

9. Shell Programming and Scripting

Sizeof a file from directory path in perl

Hai how to find size of a file?? ex : /home/kiran/pdk/sample/calibre this is a path In that I have to find size of a files in side a calibre(it is the folder) like .results or .summary (1 Reply)
Discussion started by: kiran425
1 Replies
IOPING(1)							   User Commands							 IOPING(1)

NAME
ioping - simple disk I/O latency monitoring tool SYNOPSYS
ioping [-LCDRq] [-c count] [-w deadline] [-p period] [-i interval] [-s size] [-S wsize] [-o offset] device|file|directory ioping -h | -v DESCRIPTION
This tool lets you monitor I/O latency in real time. OPTIONS
-c count Stop after count requests. -w deadline Stop after deadline time passed. -p period Print raw statistics for every period requests. -i interval Set time between requests to interval (1s). -s size Request size (4k). -S size Working set size (1m). -o offset Offset in input file. -L Use sequential operations rather than random. This also sets request size to 256k (as in -s 256k). -C Use cached I/O. -D Use direct I/O. -R Disk seek rate test (same as -q -i 0 -w 3 -S 64m). -q Suppress human-readable output. -h Display help message and exit. -v Display version and exit. Argument suffixes For options that expect time argument (-i and -w), default is seconds, unless you specify one of the following suffixes (case-insensitive): us, usec microseconds ms, msec milliseconds s, sec seconds m, min minutes h, hour hours For options that expect "size" argument (-s, -S and -o), default is bytes, unless you specify one of the following suffixes (case-insensi- tive): s disk sectors (a sector is always 512). k, kb kilobytes p memory pages (a page is always 4K). m, mb megabytes g, gb gigabytes t, tb terabytes For options that expect "number" argument (-p and -c) you can optionally specify one of the following suffixes (case-insensitive): k kilo (thousands, 1 000) m mega (millions, 1 000 000) g giga (billions, 1 000 000 000) t tera (trillions, 1 000 000 000 000) EXIT STATUS
Returns 0 upon success. The following error codes are defined: 1 Invalid usage (error in arguments). 2 Error during preparation stage. 3 Error during runtime. EXAMPLES
ioping . Show disk I/O latency using the default values and the current directory, until interrupted. ioping -c 10 -s 1M /tmp Measure latency on /tmp using 10 requests of 1 megabyte each. ioping -R /dev/sda Measure disk seek rate. ioping -RL /dev/sda Measure disk sequential speed. SEE ALSO
Homepage <http://code.google.com/p/ioping/>. AUTHORS
This program was written by Konstantin Khlebnikov <koct9i@gmail.com>. Man-page was written by Kir Kolyshkin <kir@openvz.org>. July 2011 IOPING(1)
All times are GMT -4. The time now is 08:45 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy