How to get bandwidth usage - c++

How can I calculate device bandwidth usage percentage using windows API
I tried using GetIpStatisticsEx() function but that didn't help

You could try to use GetIfTable function
GetIfTable function enumerates physical interfaces on a local system and returns this information in a MIB_IFTABLE structure. The MIB_IFTABLE structure contains an interface count and an array of MIB_IFROW structures for each interface.

Related

Why is there no WMI instance for Win32_Fan, when I do have a fan?

I am using WMI to monitor certain hardware metrics, and specifically, I am using WMIExplorer.exe to find WMI classes and their instances(link to WMIExplorer.exe download: https://www.bleepingcomputer.com/download/wmi-explorer/). When I try to retrieve instances of the Win32_Fan class within the Root\cimv2 namespace, I get 0 instances. I am wondering why this is, since I do have a fan in my laptop. Do some fans/pieces of hardware not support retrieval through the WMI interface?
Note that I also tried the "Get-WmiObject -query "SELECT * FROM Win32_Fan" command in PowerShell to confirm there are no instances; there was no output from this command. I am simply wondering if there's any cause of an instance not showing up other than the hardware simply not being compatible with WMI. Or are there alternatives to finding fan speed without downloading third-party applications?(I want to get the fan speed within a personal C++ program).
Win32_Fan instances are provided by Windows\System32\wbem\cimwin32.dll. If you disassemble it you will see that it reads SMBIOS data (specifically entries with type 27) to get fan device information. So having no such instances means your system manufacturer did not write fan device info into SMBIOS, which is part of ROM.

redhawksdr Connecting multiple instances of a waveform to a device with multiple channels

I am using Redhawk 2.0.5
I was given a Redhawk FRONTEND::TUNER device that communicates with two tuners and maps the I/Q data to a single multi-out bulkio port; with the allocationId/streamId differentiating the streams. (I have the source code so it can be modified.)
I need to connect identical SDR waveform instances so that they can use the tuner device's outputs. (I also need to connect other waveforms, but connecting a different waveform is not an issue because it will have a unique allocation ID.)
Manually I can allocate using different allocation ids .
What I need is a waveform usesdevice method OR a python code method that allows me to attach two identical waveforms to the multi-out bulkio port of the tuner device without hard coding the allocation id in the waveform's MAP file. When I try it it shows an error message something like, ALLOCATION ID ALREADY USED
There must be a way to do this but I haven't stumbled upon it yet.
Perhaps when launching the application waveform I can pass in a unique id that can be used.
Perhaps I can create two other dummy devices that will break out the tuner device into two tuner devices.
Have you looked at Chapter 8 of the manual, specifically in section 8.1.2, "Interacting with an FEI Device with the Python Package"? There are several examples of allocating FEI devices and connecting the device to a component to ingest the allocated tuner's data.

Obtaining width of WiFi networks programmatically

How do I obtain such information? After digging around I was able to find the opcodes used with WinAPI
WLAN_INTF_OPCODE enumeration
However I couldn't find the necessary means of getting information on the channel width.
Unfortunately, Windows Native Wifi Api does not present the channel width information directy. But this (as well as many other parameters) can be obtained from the Wi-Fi Beacon frames transmitted by the access points.
This information can be accessed by the WlanApi WlanGetNetworkBssList function, which returns a list of WLAN_BSS_ENTRY structures (https://learn.microsoft.com/en-us/windows/win32/api/wlanapi/ns-wlanapi-wlan_bss_entry). Via that structure you have access to all the Information Elements present in the received beacons, but you have to parse that information yourself.
I needed this feature in the project I'm working on, so I found a Python wrapper library for the WlanApi (win32wifi) and added this feature to it. You can check it out on github (https://github.com/opetryna/win32wifi/commit/35bc65df12ae8e3c579f4e867b3bfcadfb6e072a).

Interprocess Communication CUDA

I am trying to understand interprocess communication in CUDA. I would like some help with being able to understand this concept and trying to apply this to a project I am doing.
I have a image acquisition system that provides N number of input images. Each raw input image is first processed and then, stored in a single variable called 'Result'. There are four functions which do the processing of the image, Aprocess, Bprocess, Cprocess and Dprocess. Each time a new image is acquired by the system, the four functions mentioned above are called to do the processing. The final image 'Result' is stored in Dprocess.
What I would like to do is:
Create a new process, 'process2', where I can hand off one (final) image stored in 'Result', each time that image is obtained, and put it in a buffer called 'Images'. I would like to do this for 10 images. 'process2' should wait for a new image to be passed to it and not terminate because the first process has to keep calling the four functions and get a final processed image.
What I have come across so far: cudaIpcGetMemHandle, cudaIpcOpenMemHandle and cudaIpcCloseMemHandle
Question: How do I use the above function names to achieve IPC?
Question: How do I use the above function names to achieve IPC?
The CUDA simpleIPC sample code demonstrates that.
There is also a brief mention of how to use CUDA IPC API in the programming guide.
Finally, the API itself is documented in the runtime API reference manual
Note that this functionality requires cc 2.0 or higher, and a 64-bit Linux OS.

How to share image data between applications?

I already have an application called "old" which renders an image in which the image data is stored in form of session, and I need to read that data from this existing "old" application to an application called "new".
How do I pass this data? Do I need to get the memory address of the session and pass it to my other application?
And even if I have the memory address how do I read the entire data? It has loads of data stored.
Named pipes and all the others create a link between two processes and when one process writes to a memory location the other process reads it.
But I have a memory address of one process as an input, isn't the only thing that I have to do is just read the data from that memory address from the other process?
You have quite a few options to communicating between two processes
Save the data to a file and read if from the other application
Use a named pipe to establish a connection
Use a named shared memory created using win32 API calls
Use a shared memory area within a DLL loaded from both applications
As you are using C++ I would strongly suggest that you take a look at Boost interprocess. It provides nice platform independent access to interprocess communication, where most of the tedious and error prone low level details are shielded from you.
Given the leanings of your question, I would suggest #shoosh's named shared memory suggestion. I've used that before for images from cameras and such as well.