Is the code compiling alright? From the code you have posted it should dump because of how the input file is being specified specifically the code segment shown above. So how are you specifying the input filename to the compiled executable?
Hi all,
How can I quickly show Nth line from the huge file(at least more than 15GB)? I used the following script but seems slower.
See 2717298 th line.
head -2717298 data0802.dat | tail -1
Thank you very much (4 Replies)
i'm a beginner in shell and i have a txt file that is updating every second or msec so i need a program to read the last line of this txt file
is this possible to do? (5 Replies)
Hi,
I have a .txt file which contains the x, y and z co-ordinates of particles which I am trying to cast for a particular compound. The no. of particles present is of the order of 2 billion and hence the size of the text file is of the order of a few Gigabytes. The particles have been casted layer... (5 Replies)
In a txt file called, eso.txt, I have:
......
3 where process_status_flag = 70 and LISTENER_ID in (930.00, 931.00, 932.00, 933.00, 934.00)
4 group by LISTENER_ID
5 order by LISTENER_ID;
LISTENER COUNT
----------... (3 Replies)
So I have a python program that I run, which runs accordingly to options I have listed in a text file (ie user_prefs). Now there are many options listed in this user_prefs.txt, but the one of most interest to me is that of the file path of the time series.
I have over a hundred of these time... (8 Replies)
I want to add/append the info in the following format to my.txt file.
20130702|abcd20130702.txt FN|SN|DOB
I tried the below script but it throws me some exceptions.
<#!/bin/sh
dt = date '+%y%m%d'members;
echo $dt+|+members+$dt;
/usr/bin/awk -f
BEGIN { FS="|"; OFS="|"; } { print... (6 Replies)
Hi,
i have a scenario were i should compare a few fields from each line then increment a variable based on that.
Example file
989878|8999|Y|0|Y|N|V
989878|8999|Y|0|N|N|V
989878|8999|Y|2344|Y|N|V
i have 3 conditions to check and increment a variable on every line
condition 1 if ( $3... (4 Replies)
Hello All,
I have file a.txt
I want to add a counter loop at the end of each line in a file
ill explain:
i have a site h**p://test.test=Elite#1
i want to add a a counter to the number at the end of the file, that it will be like this
urlLink//test.test=Elite#1
urlLink//test.test=Elite#2... (3 Replies)
Hi All
Is there a way to export every line into new txt file where by the title of each txt output are same as the line ?
I have this txt files containing names:
Kandra Vanhooser
Rhona Menefee
Reynaldo Hutt
Houston Rafferty
Charmaine Lord
Albertine Poucher
Juana Maes
Mitch Lobel... (2 Replies)
Hi
I have problem with replace line in txt file , I have this string:
144185 DISK
Piece qqr8ot6l_1_1
--
144186 DISK
Piece ukr8pf2e_1_1
--
144187 DISK
Piece ter8p9gc_1_1
--
144188 DISK
Piece 4er8qb84_1_1
and (8 Replies)
Discussion started by: primo102
8 Replies
LEARN ABOUT FREEBSD
counter
COUNTER(9) BSD Kernel Developer's Manual COUNTER(9)NAME
counter -- SMP-friendly kernel counter implementation
SYNOPSIS
#include <sys/types.h>
#include <sys/systm.h>
#include <sys/counter.h>
counter_u64_t
counter_u64_alloc(int wait);
void
counter_u64_free(counter_u64_t c);
void
counter_u64_add(counter_u64_t c, int64_t v);
void
counter_enter();
void
counter_exit();
void
counter_u64_add_protected(counter_u64_t c, int64_t v);
uint64_t
counter_u64_fetch(counter_u64_t c);
void
counter_u64_zero(counter_u64_t c);
#include <sys/sysctl.h>
SYSCTL_COUNTER_U64(parent, nbr, name, access, ptr, descr);
SYSCTL_ADD_COUNTER_U64(ctx, parent, nbr, name, access, ptr, descr);
DESCRIPTION
counter is a generic facility to create counters that can be utilized for any purpose (such as collecting statistical data). A counter is
guaranteed to be lossless when several kernel threads do simultaneous updates. However, counter does not block the calling thread, also no
atomic(9) operations are used for the update, therefore the counters can be used in any non-interrupt context. Moreover, counter has special
optimisations for SMP environments, making counter update faster than simple arithmetic on the global variable. Thus counter is considered
suitable for accounting in the performance-critical code pathes.
counter_u64_alloc(wait)
Allocate a new 64-bit unsigned counter. The wait argument is the malloc(9) wait flag, should be either M_NOWAIT or M_WAITOK. If
M_NOWAIT is specified the operation may fail.
counter_u64_free(c)
Free the previously allocated counter c.
counter_u64_add(c, v)
Add v to c. The KPI does not guarantee any protection from wraparound.
counter_enter()
Enter mode that would allow to safely update several counters via counter_u64_add_protected(). On some machines this expands to
critical(9) section, while on other is a nop. See IMPLEMENTATION DETAILS.
counter_exit()
Exit mode for updating several counters.
counter_u64_add_protected(c, v)
Same as counter_u64_add(), but should be preceded by counter_enter().
counter_u64_fetch(c)
Take a snapshot of counter c. The data obtained is not guaranteed to reflect the real cumulative value for any moment.
counter_u64_zero(c)
Clear the counter c and set it to zero.
SYSCTL_COUNTER_U64(parent, nbr, name, access, ptr, descr)
Declare a static sysctl oid that would represent a counter. The ptr argument should be a pointer to allocated counter_u64_t. A read
of the oid returns value obtained through counter_u64_fetch(). Any write to the oid zeroes it.
SYSCTL_ADD_COUNTER_U64(ctx, parent, nbr, name, access, ptr, descr)
Create a sysctl oid that would represent a counter. The ptr argument should be a pointer to allocated counter_u64_t. A read of the
oid returns value obtained through counter_u64_fetch(). Any write to the oid zeroes it.
IMPLEMENTATION DETAILS
On all architectures counter is implemented using per-CPU data fields that are specially aligned in memory, to avoid inter-CPU bus traffic
due to shared use of the variables between CPUs. These are allocated using UMA_ZONE_PCPU uma(9) zone. The update operation only touches the
field that is private to current CPU. Fetch operation loops through all per-CPU fields and obtains a snapshot sum of all fields.
On amd64 a counter update is implemented as a single instruction without lock semantics, operating on the private data for the current CPU,
which is safe against preemption and interrupts.
On i386 architecture, when machine supports the cmpxchg8 instruction, this instruction is used. The multi-instruction sequence provides the
same guarantees as the amd64 single-instruction implementation.
On some architectures updating a counter require a critical(9) section.
SEE ALSO atomic(9), critical(9), locking(9), malloc(9), sysctl(9), uma(9)HISTORY
The counter facility first appeared in FreeBSD 10.0.
AUTHORS
The counter facility was written by Gleb Smirnoff and Konstantin Belousov.
BSD February 7, 2014 BSD