How to get physical memory by using system call ?
how to get physical memory by using system call ?What system call can I use.thanks
Use sysconf(3C) with SCPHYS_PAGES
Similar Messages
-
How to get the size of physical memory by using system call ?
how to get the size of physical memory by using system call ?What system call can be used for me to get the size of physical memor? thanks.
%vmstat 3
procs memory page disk faults cpu
r b w swap free re mf pi po fr de sr s0 -- -- -- in sy cs us sy id
0 0 0 3025816 994456 4 19 6 0 0 0 0 8 0 0 0 459 253 139 1 1 99
0 0 0 2864688 777408 0 2 0 0 0 0 0 3 0 0 0 428 134 175 0 1 99
0 0 0 2864688 777408 0 0 0 0 0 0 0 7 0 0 0 448 112 166 0 0 100
one interesting observation about vmstat I found out is (mostly on Solaris)
the first line of information always off chart, so I usually do a few interval to get constant result.
if you use linux
just
cat /proc/meminfo -
How to get swap size by using system call?
How can I get the size of swap.What system call or library Routines can be used? please help me.
Hi,
Threre's an interface called swap_ctl by wich you can get more information related to virtual memory. Here's an example:
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/swap.h>
#include <sys/param.h>
int
main(int argc, char*argv[])
swaptbl_t *st;
int swap_count, i;
long long swap_total=0, swap_avail=0;
long pgsize_in_kbytes = sysconf(_SC_PAGE_SIZE) / 1024L;
if ((swap_count=swapctl(SC_GETNSWP, NULL)) == -1)
perror("swapctl(SC_GETNSWP)"), exit(-1);
if (swap_count == 0)
(void)printf("No swap files/partitions allocated\n"), exit(0);
* Although it's not particularly clear in the documentation, you're
* responsible for creating a variable length structure (ie. the
* array is within the struct rather than being pointed to
* by the struct). Also, it is necessary for you to allocate space
* for the path strings (see /usr/include/sys/swap.h).
st = (swaptbl_t*)malloc(sizeof(int) + swap_count * sizeof(struct swapent));
if (st == NULL)
perror(argv[0]), exit(-1);
st->swt_n = swap_count;
for (i=0; i < swap_count; i++) {
if ((st->swt_ent.ste_path = (char*)malloc(MAXPATHLEN)) == NULL)
perror(argv[0]), exit(-1);
if ((swap_count=swapctl(SC_LIST, (void*)st)) == -1)
perror("swapctl(SC_LIST)"), exit(-1);
for (i=0; i < swap_count; i++) {
swap_total += st->swt_ent.ste_pages * pgsize_in_kbytes;
swap_avail += st->swt_ent.ste_free * pgsize_in_kbytes;
(void)printf("Total swap = %lld available swap = %lld\n",
swap_total, swap_avail);
return 0;
There's a very interesting document about Solaris Kernel/Performance Stats available at http://www.idiom.com/~gford/admin/howto/perf.html. Very interesting.
Hope this helps -
How to execute a cvs command using System Call?
hi all,
how to execute a cvs login command using system call ?
thanks,
damTo anyone that reached this post and still dont have a hint, try this small sample - it logs on CVS using installed CVSNT and execute a fake update:
package testeCVS;
import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
public class execCMD
String password="yourPassword";
String directory="C:\\CVS\\yourPathToProject";
//send commands to CVS and shows the resulting screen
public int sendCMD(String[] command) throws IOException, InterruptedException
ProcessBuilder pb = new ProcessBuilder(command);
pb.directory(new File(directory));
pb.redirectErrorStream(true); // merge stdout and stderr
Process p = pb.start();
InputStreamReader isr = new InputStreamReader(p.getInputStream());
BufferedReader br = new BufferedReader(isr);
String lineRead;
StringBuilder buffer=new StringBuilder();
System.out.println("Return of shell:");
while ((lineRead = br.readLine()) != null)
buffer.append(lineRead + "\n");
System.out.println(buffer.toString());
return p.waitFor();
//send commands to CVS, send the password after the prompt and show the resulting screen
public int sendDialogCMD(String[] command) throws IOException, InterruptedException
ProcessBuilder pb = new ProcessBuilder(command);
pb.directory(new File(directory));
pb.redirectErrorStream(true); // merge stdout and stderr
Process p = pb.start();
PrintWriter writer = new PrintWriter( new OutputStreamWriter( p.getOutputStream() ));
writer.println( password );
writer.flush();
InputStreamReader isr = new InputStreamReader(p.getInputStream());
BufferedReader br = new BufferedReader(isr);
String lineRead;
StringBuilder buffer=new StringBuilder();
System.out.println("Return of shell:");
while ((lineRead = br.readLine()) != null)
buffer.append(lineRead + "\n");
System.out.println(buffer.toString());
return p.waitFor();
public static void main(String a[]) throws IOException, InterruptedException
execCMD e=new execCMD();
String[] command = new String[5];
command[0] = "cvs";
command[1] = "-q";
command[2] = "-d";
command[3] = ":pserver:yourUserID@localhost:2402/path/of/yourProject"; //in this case using CVS port 2402
command[4] = "login";
System.out.println("exit value=" + e.sendDialogCMD(command));
command = new String[8];
command[0] = "cvs";
command[1] = "-q";
command[2] = "-d";
command[3] = ":pserver:yourUserID@localhost:2402/path/of/yourProject";
command[4] = "-n";
command[5] = "-q";
command[6] = "update";
command[7] = "-dA";
System.out.println("exit value=" + e.sendCMD(command));
}It is possible to send the password on the same command, but I had problems when the password had the character '@' because CVSNT took it as the separator between the username and server name. In that case the command is: ":pserver:yourUserID:yourPassword@localhost:2402/path/of/yourProject" -
How to get total physical memory on the system thru program
Hi,
I have used kstat for identifying physical & virtual memory. I am able to get the data items of vminfo_t, but vminfo_t doesnot give the total physical memory all I get fro vminfo_t is
free memory, swap reserved, swap allocated, swap available and swap free.
Can someone help me in getting total physical memory of the system.
Thanks,
RamI do not believe you can get the physical number of pages through kstat. However, you can get it through sysconf(3C). The argument SCPHYS_PAGES will return the number of pages in the system.
See the sysconf(3C) manpage for more information.
Alan
Sun Developer Technical Support
http://www.sun.com/developers/support -
How to get web application to use Tuscany without conflicting with SAP SDO
Hi,
We are attempting to run a web application on SAP NetWeaver CE 7.1 SP1 which uses Tuscany SDO. As it now stands We must use Tuscany because the web application will not run with the SAP SDO implementation provided by Netweaver. To ensure that Tuscany is loaded with priority, we have packaged the Tuscany JAR files and their dependencies as a heavy resource, as described here:
http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/60642a88-95fe-2b10-d387-a245d48fc257?overridelayout=true
The final check showed that Tuscany was correctly deployed as a heavy resource and included the following JAR files:
common-2.2.3.jar
ecore-2.2.3.jar
ecore-change-2.2.3.jar
ecore-xmi-2.2.3.jar
tuscany-sdo-impl-1.1.1.jar
tuscany-sdo-lib-1.1.1.jar
tuscany-sdo-tools-1.1.1.jar
xsd-2.2.3.jar
We also verified that the web application using Tuscany has a hard reference to the Tuscany heavy resource.
However, when we try to run the web application, the following error is logged: java.lang.LinkageError: Class commonj/sdo/DataGraph violates loader constraints
The issue is definitely due to some kind of classloading conflict with the SAP SDO library, as the application runs normally when SAP SDO is manually removed from the classpath. Doing this on a production system is unfortunately not an option, though.
So the question is: how to get web application to use Tuscany without conflicting with SAP SDO?I took a look at the "printerReady" example. Looks like I may be able to use the InetPing (...) function to ping through a range of IP addresses looking for a response.
Any ideas on how to find the MAC address associated with the IP addresses that respond?
We may have multiple units responding and the MAC address will allow the operator to determing which unit to connect to.
I'll try the InetPing to see how it works,
Kirk -
How to use system call in assembler
I write codes to display the dictionary using C,
and it can run well,and then I want to use system call
in assembler to realize the same function ,but it doesn't
display the dictionary,how to correct it?
Look:
//C
#include <stdio.h>
int main()
char *name[2];
name[0]="/bin/ls";
name[1]=NULL;
execve(name[0],name,NULL);
return 0;
//Assembler
.data
msg:.string "/bin/ls"
.text
.global _start
_start:
movl $0xb,%eax
movl $msg,%ebx
mov $msg,%ecx
movl $0,%edx
int $0x80
movl $1,%eax
movl $0,%ebx
int $0x80If you compile with -Wwrite-strings, as I like to do for new code, you'll notice it warns about assigning the address of read-only memory to a plain char *. You might want to declare name as follows to avoid accidentally trying to modify it:
char const *name[2];
But as for your question. The execve system call requires a pointer to a list (array) of pointers to strings in %ecx. You are passing it a pointer to a single string, which means it will try to interpret the string ("/bin/ls")as a series of pointers to strings, with potentially disastrous (and certainly weird) results.
Last edited by Trent (2012-12-28 15:31:38) -
How to get the computer name using C#?
Hi all,
Does anyone know how to get the computer name using c#?
ThanksTry this, string computer_name = System.Environment.GetEnvironmentVariable("COMPUTERNAME");
Naren. -
How to get the properties of my system ?
Hi,
does someone know how to get the properties of my system (like RAM,processor,OS ...) ?
Thanks, Fred.Hi!
Try this:
import java.util.Properties;
public class Props {
public static void main(String[] args) {
// This shows all the properties
System.getProperties().list(System.out);
// This retrieves a special property
System.out.println(System.getProperty("java.runtime.name"));
// Here is to get total system memory
long totalMemory = Runtime.getRuntime().totalMemory();
System.out.println("Total memory: "+totalMemory);
// Here is to get free system memory
long freeMemory = Runtime.getRuntime().freeMemory();
System.out.println("Free memory: "+freeMemory);
}Hope it helps!
/Andrew -
Hi All,
How to get the physical SQL query for the OBIEE reports.
Thanks in advance,
Haree.Hi Anitha,
Thanks for your reply,
I am getting XML script in log file. (Settings > Administration > Manage Sessions > View Log).
How to get physical SQL query ?
Thanks,
Haree -
since I upgraded to os 5.1 for my iPhone I can no longer type in reminders. Any suggestions how to get around having to use siri for reminders?
Unfortunately, I have a very similar problem. Since I upgraded to os 5.1 on my new iPhone 4S the reminders screen will not add new reminders or scroll up and down. What's more strange is the screen will still scroll side to side allowing access to the Completed list, and both the Completed list and Date functions work normally so this must be an upgrades glitch.
-
How to get default values while using the transaction "BP"
Hi Group,
I have a query on how to get default values while using the transaction <b>BP</b>?
The thing is:
when I enter into the transaction "BP", I need to see some default values to some of the input fields in the screen.
how can I achieve this?
So please kindly let me know the procedure to achieve this.
Thanks & Regards,
Vishnu.Hi,
The events of BDT can be used to default some fields on creating a partner.
For this create a function module for ISDAT. attach that event in BUS7.
In the ISDAT funtion modulethe following code should be used.
For example to set the nationality:
I_BUSDEFAULT-NATIO = 'DE.
CALL FUNCTION 'BUP_BUPA_FIELDVALUES_SET'
EXPORTING
i_busdefault = I_BUSDEFAULT
Regards, Smita. -
How to get a field that using variable in order to create a query
Hi,
I found a difficulty when creating a query. so, I would like to ask you some question.
1. How to get a field that using variable which that field I want to put it in my query?
For example, I would like to take quantity field in inventory audit report. And when I put my cursor in
quantity field, there was only variable, item, etc. How to get this and put it in query?
2. How to combined the invoice quantity with inventory audit report quantity?
3. I have a query like this:
SELECT distinct T0.[DocDate] as 'Tanggal', T0.[DocNum] as 'No.Faktur', T1.[ItemCode] as 'Kode Barang',
T1.[Dscription] as 'Deskripsi', T1.[Quantity] as 'Quantity', ((T1.[LineTotal])/(T1.[Quantity])) as 'Harga
Satuan', T1.[LineTotal] as 'Harga Total', T3.[CalcPrice] as 'HPP Satuan', ((T3.[CalcPrice]) * (T1.
[Quantity])) as 'HPP Total', T4.[ItmsGrpNam] as 'Jenis Barang', T5.[SlpName] as 'Nama Sales', T1.
[WhsCode] as 'Kode Gudang' FROM [dbo].[OINV] T0 INNER JOIN [dbo].[INV1] T1 ON T0.DocEntry =
T1.DocEntry INNER JOIN OITM T2 ON T1.ItemCode = T2.ItemCode INNER JOIN OINM T3 ON T2.ItemCode
= T3.ItemCode INNER JOIN OITB T4 ON T2.ItmsGrpCod = T4.ItmsGrpCod INNER JOIN OSLP T5 ON
T0.SlpCode = T5.SlpCode WHERE T3.[TransType] = '13' and T3.[CreatedBy] = T1.[DocEntry] and T0.
[DocDate] >=[%0] and T0.[DocDate] <=[%1] and T4.[ItmsGrpNam] =[%2] and T1.[WhsCode] =[%3]
Is it possible if I just take one invoice with invoice quantity and only show up at once although I have a
lot item cost for that item? (because I'm using FIFOmethod).
Please help me.. cause I'm stuck with this thing :l.
Thank you very much, and I'm waiting your respon soon.
Regards,
SiscaTry this one:
SELECT distinct T0.DocDate as 'Tanggal', T0.DocNum as 'No.Faktur', T1.ItemCode as 'Kode Barang',
T1.Dscription as 'Deskripsi', T1.Quantity as 'Quantity', ((T1.LineTotal)/(T1.Quantity)) as 'Harga
Satuan', T1.LineTotal as 'Harga Total', T3.CalcPrice as 'HPP Satuan', ((T3.CalcPrice) * (T1.
Quantity)) as 'HPP Total', T4.ItmsGrpNam as 'Jenis Barang', T5.SlpName as 'Nama Sales', T1.
WhsCode as 'Kode Gudang'
FROM dbo.OINV T0 INNER JOIN dbo.INV1 T1 ON T0.DocEntry =T1.DocEntry
INNER JOIN OITM T2 ON T1.ItemCode = T2.ItemCode
INNER JOIN OINM T3 ON T2.ItemCode = T3.ItemCode AND T3.TransType = '13' and T3.CreatedBy = T1.DocEntry AND T3.Warehouse = T1.WhsCode
INNER JOIN OITB T4 ON T2.ItmsGrpCod = T4.ItmsGrpCod
INNER JOIN OSLP T5 ON T0.SlpCode = T5.SlpCode
WHERE T0.DocDate >=[%0\] and T0.DocDate <=[%1\] and T4.ItmsGrpNam =[%2\] and T1.WhsCode =[%3\]
Thanks,
Gordon -
How to get the context data using java script in interactive forms
Hi All,
How to get the context data using java script in interactive forms by adobe, am using web dynpro java
thanks.Hi venkat,
Please Refer this link.
Populating one Drop-Down list from the selection of another Drop-down list
Thanks,
Raju. -
How to get the list of Used Quotations & Non Used Quotations
Hi MM Gurus,
How to get the list of Used Quotations & Non Used Quotations.
i am not talking about Open quotation ,closed quotation..
if once i created PO through quotation it should be used quotation. i not created PO through quotation
it s should be Non used quotation. how to get this list through when we create PO through ME21N
document over view. is there any opetion in Dynamic selection or somthing ..???
Thanks in Advance..
Anthyodaya.ok.
Maybe you are looking for
-
Outgoing Payment Generates Negative Docentry
After creating New financial year ,Outgoing Payment Docentry generated is Negative. What could be the problem for negative Docentry generation.
-
Maximum size of a robohelp project
Hi All, Assuming you have a high-powered computer, what is the maximum size you would recommend for a RoboHelp 7.0 project? Is there a limit specified? Is there a limit for the number of topics allowed? Thanks, Jen
-
Tabs and windows keep opening with adverts and downloads which I can't stop
New tabs with adverts, downloads etc keep opening on firefox also new windows trying to get me to install supposed repair tools (eFix Now). Have run ADWCleaner, Malware Bytes, TDSSkiller, uninstalled adn reinstalled firefox but not getting anywhere..
-
Mac Mini G4 with Photoshop CS2
I have a Mac Mini G4 512 MB of Ram. I want to get Photoshop CS2. Has anyone experienced slow response or issues with Photoshop CS2 on a Mac Mini G4?
-
Wicked Problem Installing Elements 2.0
Trying to install Photoshop Elements 2.0 on Windows 8.1 (says scratch disk full) Tried several times. Adjusted scratch disk size, etc,, Found a Forum where someone was succesful. It can be done. I just can't do it. Any/All suggestions PLEEEEEEEZ! LOV